<?php
namespace Home\Controller;
use Think\Controller;
class InterfaceController extends Controller {
    public function sizhuData(){//八字  四柱数据
        $ymd=$_REQUEST['ymd'];
        $hour=$_REQUEST['hour'];
        judgeData(array($ymd),$_REQUEST);
        zwmp($ymd,$hour,'男','NOdayun');
        $sizhu=I('globals.sizhu');
        $rikong=I('globals.rikong');//日空/旬空/空亡
        $Arr=array(
            'sizhu'=>$sizhu,
            'rikong'=>$rikong,
        );
        echo json_encode($Arr,JSON_UNESCAPED_UNICODE);
    }
    public function testing($zymd,$orderid,$token,$caName,$channel){//检测
//        if(empty($zymd)){
//            echo '缺少参数';exit;
//        }
//        if(empty($channel)){
//            echo '缺少渠道号';exit;
//        }
//        if(empty($orderid)){
//            echo '缺少订单号';exit;
//        }
//        $APItoken=md5('Interface'.$caName.date('Y-m-d').'d5s126wwrsd648xc546afg2136xcge');
//        $LXMtoken=md5('Interface'.$caName.date('Y-m-d').'lxmfg85h4d12f54h8j9k6i85q5as2x');//蓝星漫
//        if($token!=$APItoken&&$token!=$LXMtoken){
//            echo 'token有误';exit;
//        }
//        if($token==$LXMtoken){
//            cookie('remark','LXM');
//        }else{
//            cookie('remark',null);
//        }
        exit;
    }
    public function insertOrder($zymd,$hour,$zsex,$shop,$znickname,$channel){//记录订单
//        $y=mb_substr($zymd,0,4);//年
//        $m=mb_substr($zymd,5,2); //月
//        $d=mb_substr($zymd,8,2);//日
//        if(empty($hour))$hour=0;
//        if(empty($zsex))$zsex=0;
//        $datetype=0;
//        $price=1;
//        $remark=cookie('remark');
//        $arrdata=M()->query("select id,price from smhezuo_h5test where ordernum='{$shop}' limit 1");
//        if(empty($arrdata)){
//            M()->query("insert into smhezuo_h5test (ordernum,price,username,typeid,sex,status,datetype,year,month,day,hour,paykind,ip,channel,remark)values(
//                                          '{$shop}','{$price}','{$znickname}',0,{$zsex},-1,'{$datetype}',{$y},{$m},{$d},{$hour},-1,'{$_SERVER['REMOTE_ADDR']}','{$channel}','{$remark}')");
//        }else{
//            M()->query("update smhezuo_h5test set price='{$arrdata[0]['price']}'+1,channel='{$channel}' where ordernum='{$shop}'");
//        }
    }

    public function bzjp(){//八字精批数据
       //接口
        $zymd=I('request.ymd');
        $hour=I('request.hour');
        $sex=I('request.sex');
        $orderid=I('request.orderid');
        $token=I('request.token');
        $channel=I('request.channel');

        $this->testing($zymd,$orderid,$token,'bzjp',$channel);

        //创建订单
        $hour=$hour;
        $shop=$orderid;
        $znickname='匿名';
        $zsex=$sex;if($zsex=='')$zsex=1;

        $this->insertOrder($zymd,$hour,$zsex,$shop,$znickname,$channel);

        if($sex==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($hour%2){$hour-=1;}
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'zw');
            $ssarray=array();
            array_push($ssarray,implode(I('globals.nianzhuss')));
            array_push($ssarray,implode(I('globals.yuezhuss')));
            array_push($ssarray,implode(I('globals.shizhuss')));
            $this->assign('nianzhuss',$ssarray);//十神

            liunian(I('globals.bznianzhu'));
            fortune(I('globals.shengxiao'),I('globals.bzrizhu'));
            $liunian=I('globals.liunian');
            wuxing_healthy(mb_substr($liunian['ny'],2,1,'utf-8'));
            $this->assign('wuxing',I('globals.wuxing'));//健康五行
            $wuxing=I('globals.wuxing');
            wuxing_healthy(I('globals.xiys'));
            $this->assign('cause',I('globals.wuxing'));//事业喜用神

            //紫薇
            cyzk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $cyzkzx=I('globals.cyzkzx');//财运主星
            syfz(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $syfzzx=I('globals.syfzzx');//事业主星
            hyqg(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $hyqgzx=I('globals.hyqgzx');//婚姻主星
            zsqk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'));
            $zsqkzx=I('globals.zsqkzx');//自身主星
            $ziweiFenxi=BZziweiFenxi($syfzzx,$cyzkzx,$hyqgzx,$zsqkzx);
            $this->assign('ziweiFenxi',$ziweiFenxi);


//            $guaciJX=guaciJX(cookie('minute'));//卦辞
//            $this->assign('guaciJX',$guaciJX);
        }
        if($_REQUEST['ymd']) {//判断是否是接口
            $liuyueYC=array(
                0=>'本年运势较低落的月份是农历二月、五月、九月、十一月在这段时期小人妨害，多加留心。较为顺利的月份是农历正月、三月、四月、九月、十月、十二月目标明确，收获良好。',
                1=>array(
                    'name'=>'正月壬寅运气诸事顺调',
                    'text'=>'这是一个交际圆满的月份，但不可荒怠本身的业务。工作方面目前的状况已经不是很好了，需要步步小心，不要再节外生枝，先集中精力把以前遗留的问题解决。尤其是靠交际关系维系的事业，将会有不错的成果，有机会大赚一笔，找新工作也有机会找到薪水不错的工作，把握机会。财运要注意了，目前最重要的是把钱存起来，除了必要的生活费用，不建议购买任何东西。或做任何投机及事业的投资减少和朋友出去玩的机会吧，会有不小的花费。金钱上会出现不稳定的状况，花费要注意，太大的消费先暂停一下吧！感情上有新的突破口，不过不要表达的太明白哦！有时候朦胧美更吸引人，尝试用些甜蜜的小手段，会让对方更喜欢你。需健康上要留意脊椎，必要时要检查一下，可以做些别太激烈运动！也注意家人的健康一下。多跟好友分享生活中的一切，好好享受跟朋友相聚的欢乐。'
                ),
                2=>array(
                    'name'=>'二月癸卯运气慎防小人',
                    'text'=>'作事须防有纠缠，须戒贪念，并避酒色，交友须小心，男人慎防美人计及纠缠。男女均易被诱惑，故应远离酒色财气。工作方面如果有计划要实施请注意，有成功的可能，但是这个成功是短暂的，所以留心计划的周密性和实施人的执行能力。财运上受到了阻碍，需要更多的耐心更多的毅力，不要给自己太大的压力，会影响健康。感情上很美好的一月，但自己必须谨慎小心会因为不必要的情感纠纷，而影响了进行中稳定得情感，而失去对方的信任，单身的朋友本周可以请熟人帮忙介绍，机会很大哦！人际关系上别浪费太多时间在玩乐上。多自我沉思精进反省，壮大自己能力。'
                ),
                3=>array(
                    'name'=>'三月甲辰运气红鸾星动',
                    'text'=>'事业方面可以考虑向更高一步迈进，要对自己有信心，现在不适合原地踏步。事情都要谨慎对待，任何细节都会影响到今后，金钱上花费会比较大，买到的东西不是很喜欢不过也说不上讨厌，所以可以考虑过段时间再大批购物。这个月有大型的消费、买车或买房。本月投资适合考虑长线。感情会有新的发展或进入到更深的关系！别拘泥太多细节、也别听太多人的意见。真正幸福是双方的，真心能陪伴走一辈子的伴侣才是真的。未婚男女，将有婚姻之喜。婚谈、结婚均吉。 则可积极进行所希望的事。健康上还是要非常注意，加强抵抗力是必须的，也许不是大病，小病也会令自己的身体耗损元气吧！身体上不要再逃避现实，认真面对对好好做个调理身体的计划。宜出外走动、出差外地或是与伴侣出游，多安排休闲活动适当放松。'
                ),
                4=>array(
                    'name'=>'四月乙巳运气喜气盈门',
                    'text'=>'营谋作事，均能遂意。惟不可非为乱作，独断独行。业务顺调，顺进平稳。计划新事业，时机未成熟，不宜轻易进行。工作方面目前的状况已经不是很好了，需要步步小心，不要再节外生枝，先集中精力把以前遗留的问题解决。但只要有人可以帮忙协助，其实都可以化解。 此月在内心世界，不要给自己太多的压力，或太高的标准。否则在你心里，会生有太多的不满，徒生烦恼。金钱上出现不稳定的状况，花费要注意，太大的消费先暂停一下吧！婚谈适宜。多听取他人善意的意见，对已有益遇事要多运用自己的智慧来处理。到了结婚年龄的男女，有好消息到了。婚谈颇仍，要积极才好，不可怕羞。健康上要留意脊椎，多运动！人际关系上和朋友相处的比较多，相应会需要些花费，但内心仍觉得空虚。'
                ),
                5=>array(
                    'name'=>'五月丙午运气慎言慎行',
                    'text'=>'工作上稳定，可以用稳操胜券来形容，需要注意的是得到成功的同时也要付出代价，如果不能认同这点成功也不会长久。做事、交际，都能应付裕如。情场交游要注意。心平气和地从事职务，生活态度不可暴躁，并注意家庭圆满。本月可以为金钱方面做决定，想投资的话也可以认真考察。财务上要小心周围的人或事，并不是表面的样子，心里要有自己的打算。感情上要注意有因为金钱而发生不愉快的征兆，空虚感会有些强烈，认清心底最想要的是什么吧！健康上会看到希望，不再在沉浸在悲观的情绪中。健康方面对身体好的事情要一直坚持下去。要重新认识自己的朋友，不要抗拒变化。广结善缘，会为自己带来好运。'
                ),
                6=>array(
                    'name'=>'六月丁未运气凡事如意',
                    'text'=>'作方面不要放过机会，之前的计划都可以拿出重新考虑，也要用足够的时间思考一下之前的工作态度是否有什么不妥，应该做个改变才对。工作量多而紧张，随时和周围的人保持密切联系，以便实时取得协助。公司内部意见分歧，步调不一而影响了工作效益对金钱有所节制，但该享受时，还是要舍得些，给自己一些生活质量也是应该的。财务上计划需要改变，投资计划或收获并不会如预期的来临，随着环境的变化而改变吧，将来也许会有不错的收获。花些钱买自己渴望以久的礼物，单纯的令自己开心的喜悦感情上要小心会只看到对方的缺点，忽视优点而产生失落感！太多时间在一起反而问题多多。聚少离多，未必不好，多给彼此空间自由。只要彼此的情谊不变，反而在一起时，会更加甜蜜。健康上想要得到的效果没那么快到来，继续持之以恒的坚持才可以。所以长时间对健康的照顾，是一种耐力了。来往的大部分都是同事，和老朋友老同学聚聚，那种气氛会让你彻底放松。'
                ),
                7=>array(
                    'name'=>'七月戊申运气诸事顺调',
                    'text'=>'业务上有良机，须具有热忱，专心从事。切戒骄傲自满。 得意之时，须防危险。不可高估自己的力量，否则会失败。工作上有被欺骗的迹象，仔细想自己份内的工作细节，没有准备周全就不要贸然开始，相信自己的直觉。只要小心能可胜任所有工作。财运不错，可以尝试进行一点投资，长期低风险的比较合适，购物方面要相信自己的直觉。财运还不错，做事要积极，不要怕阻得，可得贵人助。 营谋做事，均能遂意。惟不可非为乱作，独断独行。感情上两人会发生些不愉快，有问题大家面对面的讲清楚会更好。误会说明厘清后，感情会更好。健康方面会对自己的身体做一些规划但还不会做出行动，找出给自己行动的动力。不太想在人际上花太多心思，那就一个人好好独处吧！'
                ),
                8=>array(
                    'name'=>'八月己酉运气利女平男',
                    'text'=>'运势阴盛阳衰，男人须防桃花运，如能严肃私生活，自然无事。女性最得意均的一月，诸事意外顺调，对新事业、新计划，不妨尝试。工作上业绩还没有达到要求，但有后来居上的现象。找新工作会有机会但不一定抓得住。 但还是要多尝试，也许有新工作机会的人 ，可以好好把握。财运不错，可以尝试进行一点投资，长期低风险的比较合适，投资计划方面要相信自己的直觉。感情上彼此的期望都很大，可以利用这月增进感情，单身的朋友锁定目标成功的希望非常大。感情方面周围人对你的诱惑非常大，要清醒的认识到你究竟想要什么样的生活，其实两人的感情基础很好，只要保持就可以了。不过还是小心第三者介入。健康上多做肩颈部和肩膀的运动人际方面会很多朋友但不一定长久，不要太过投入。知心朋友几人就好。看似很平静的。'
                ),
                9=>array(
                    'name'=>'九月庚戌运气谨言慎行',
                    'text'=>'会有些想法，不过要从实际考虑，行动力方面要加强定的目标方向，自己必须如实完成。工作别拖延，对工作态度认真积极可以增加人对你的认同跟信任。反之，也必然。钱财交接须小心，与人合伙不利。尢其对事业经营，必须量力而为。不要轻言易诺。财运不佳，减少开销是必须，有因为金钱和别人吵架的征兆。尤其有合伙生意难免有纷争，小心伤了彼此之间感情。感情上两人存在很多的问题，不过正逐渐的向好的方向发展，刚刚在一起的两人需要注意不要让太多人知道你们的关系，有见光死的迹象。也会因为会比较忙，所以没有太多的时间和精力相处，双方要注意沟通，避免因此产生裂痕。也不要轻易给出承诺。家庭内，注意口舌风波。夫妇和合，家和万事成。身体要注意，因为不注意饮食，引起的肠胃问题。人际关系上反而不错，不过也只是表面的风光了，内心的空虚不是别人可以解决的。'
                ),
                10=>array(
                    'name'=>'十月辛亥运气天赋良机',
                    'text'=>'不要松懈，积极行动，向既定目标，全力以赴，必得满意收获。工作上要保持理性和清晰的方向感，因为你做的很多事都是即繁杂又没必要，但又必须得做的，按部就班的做吧！不可大意。虽然财运很好，最怕财多身弱，若破财，反消灾，财运上会有是很重要的转机，运用好的话可以大赚，目前耐心等待好消息吧！感情上若能在感情稳定下论婚嫁是很不错的。一旦两人之间，虽存在很多的问题，不过正逐渐的向好的方向发展，如果是刚刚在一起的两人需要注意不要让太多人知道你们的关系，有见光死的迹象。夫妻须防反目，家和万事成。健康方面要注意可能因为太忙而忽略了饮食，肠胃会有损伤。小毛病也要慎防。人际关系不错，只是不要太过讨好别人而失去自我。'
                ),
                11=>array(
                    'name'=>'十一月壬子运气满极招损',
                    'text'=>'工作上会有些波折，不过只要冷静的面对都可以安然渡过，尽量遵循过去的经验做事吧！别使感情困扰自己工作。作事须防有纠缠，戒贪念与酒色，自然安泰无事。财务上运气是很不错，各方面都保守为好，怕有意外波折使自己守不住，而造成损失。感情上双方感情很稳定，如果好好经营不会有人来妨害，但不免外在的诱惑依然存在，彼此的信任跟把持都很重要。要彼此互相努力些维系了。。感情上要保持清醒，有被欺骗的可能，只要保持男女之间交往也尽量别涉及金钱，但付出的感情就必须靠时间来疗愈了不能再忽视自己的身体了，该做些适合自己的运动，在饮食上也要吃些合适自己的营养食品，食补很重要。和同事朋友说话务必要注意，不要得罪人。避免让对方留下不好印象。'
                ),
                12=>array(
                    'name'=>'十二月癸丑运气喜气洋洋',
                    'text'=>'工作上有些事情让你犹豫不决，总是不能做出决定，情况会更加混乱而你的情绪也会越来越多，不如面对现实吧，早做决定做了结。在消费上请让自己保持理智，避免买些不实用的东西。虽然经济不是很大问题，自己还是必须节制。现实生活会影响两人的感情，可以重新思考这段感情，庆幸的是你已经意识到这些，那就重新找到自己的人生观吧！也可能会在这时候愿意承诺对方，给对方真正一个家。看是否这段感情是你想稳定下来的对象。花逢雨露，满面春风。婚谈、结婚、交易、旅行均吉利。你会找到理想的对象的。不能再忽视自己的身体了，该做些适合自己的运动，在饮食上也要吃些合适自己的营养食品，食补很重要。人际关系方面太过迁就别人而失去自我，精神空虚，赶紧找一份寄托吧！该拒绝就拒绝！多做自己想做的吧！'
                ),
                'fortune'=>I('globals.fortune'),
            );
            $selectArr=array(
                'sizhu'=>I('globals.sizhu'),
                'nianzhuss'=>$ssarray,
                'canggan'=>I('globals.canggan'),
                'zhishen'=>I('globals.zhishen'),
                'sizhuny'=>I('globals.sizhuny'),
                'bzdishi'=>I('globals.bzdishi'),
                'wxsqs'=>I('globals.wxsqs'),
                'xiys'=>I('globals.xiys'),
                'taiyuan'=>I('globals.taiyuan'),
                'rikong'=>I('globals.rikong'),
                'dayun'=>I('globals.dayun'),
                'dayunx'=>I('globals.dayunx'),
                'dayuny'=>I('globals.dayuny'),
                'dayungz'=>I('globals.dayungz'),
                'zyinli'=>cookie('zyinli'),
                'liunian'=>I('globals.liunian'),
                'shortcoming'=>I('globals.shortcoming'),
                'fortune'=>I('globals.fortune'),
                'congenital'=>I('globals.congenital'),
                'becareful'=>I('globals.be_careful'),
                'lovefenxi'=>I('globals.lovefenxi'),
                'arrtaohua'=>I('globals.arrtaohua'),
                'shengxiaosh'=>I('globals.shengxiaosh'),
                'wuxing'=>$wuxing,
                'cause'=>I('globals.wuxing'),
                'ziweidoushu'=>$ziweiFenxi,
                'liuyue2018'=>$liuyueYC,
            );
            $json=json_encode($selectArr);
            echo $json;
        }
    }
    public function bzcy(){//八字财运
        //接口
        $zymd=I('request.ymd');
        $hour=I('request.hour');
        $sex=I('request.sex');
        $orderid=I('request.orderid');
        $token=I('request.token');
        $channel=I('request.channel');

        $this->testing($zymd,$orderid,$token,'bzcy',$channel);

        //创建订单
        $hour=$hour;
        $shop=$orderid;
        $znickname='匿名';
        $zsex=$sex;if($zsex=='')$zsex=1;

        $this->insertOrder($zymd,$hour,$zsex,$shop,$znickname,$channel);

        if($sex==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($hour%2){$hour-=1;}
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'zw');
            $ssarray=array();
            array_push($ssarray,implode(I('globals.nianzhuss')));
            array_push($ssarray,implode(I('globals.yuezhuss')));
            array_push($ssarray,implode(I('globals.shizhuss')));
            $this->assign('nianzhuss',$ssarray);//十神
            lnyuncheng($zymd,I('globals.dayun'),I('globals.dayunss'));
            fortune(I('globals.shengxiao'),I('globals.bzrizhu'));
            syfz(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));

            bzcaiyun(I('globals.sizhu'),$zymd);

//            dump(I('globals.syarrzhux'));
//            exit;
        }
        $dayunNum=I('globals.dayun');
        $dayunArr=array($dayunNum,$dayunNum+10,$dayunNum+20,$dayunNum+30,$dayunNum+40,$dayunNum+50,$dayunNum+60,$dayunNum+70);
        $arrcyd=I('globals.arrcyd');
        $arrcyy=I('globals.arrcyy');
        $arrzygua=I('globals.arrzygua');
        if($arrzygua['jixiong']=='凶'){
            $xj=array(
                'qishi'=>'不占财运，得到该卦，为凶，不免有些耗破散财之事，要合理控制开支。对于流动性较大的业务来说，会有较多机会，但也容易大起大落。财上若有所获，更应理财为上，凡事有规划的花销，切忌不宜过度。切记：理财必须加倍小心谨慎，稍有疏忽，钱财便会大量流泄不止。',
                'xj'=>'凶。财运欠佳，有些时候会有难关需要渡过，但最后都能逢凶化吉。',
            );
        }else{
            $xj=array(
                'qishi'=>'占财运，得到该卦，为吉，说明财运较旺。时机到来的时候，应将其紧紧抓在手中，重要事情亲力亲为，慢慢就会获大利。切记：财运虽好，仍须小心谨慎，不可过于松懈、大意，以免好时机在不经意间溜走。',
                'xj'=>'吉。财运俱佳，但初期得财后，仍要谨慎从事。',
            );
        }
        $selectArr=array(
            'sizhu'=>I('globals.sizhu'),
            'nianzhuss'=>$ssarray,
            'canggan'=>I('globals.canggan'),
            'zhishen'=>I('globals.zhishen'),
            'sizhuny'=>I('globals.sizhuny'),
            'bzdishi'=>I('globals.bzdishi'),
            'wxsqs'=>I('globals.wxsqs'),
            'xiys'=>I('globals.xiys'),
            'taiyuan'=>I('globals.taiyuan'),
            'rikong'=>I('globals.rikong'),
            'dayun'=>$dayunArr,
            'dayungz'=>I('globals.dayungz'),
            'dayunss'=>I('globals.dayunss'),

            'fcTime'=>array(
                'text'=>'少年发财，父母祖辈条件好，衣食无忧。财富多来于意外所得。当在少年之时多多从事各种意外之事，买张彩票便中大奖的事极有可能在你身上发生。若能在少年之时懂得花钱容易赚钱难的道理，你便可一辈子不为钱财所忧。',
                'fc_time'=>$arrcyd['fc_time'],
            ),
            'zhengcai'=>array(
                'text'=>'正财不多，偏财尚可，初运平常，作事虽非逆境，然未十分称心，须等中限交进，渐渐步入顺境。经商得弊均半，不义之事，切勿妄行。',
                'tezheng'=>$arrcyd['features_day'].$arrcyy['features_year'],
            ),
            'zpcai'=>I('globals.zpcai'),
            'shengxiao'=>I('globals.shengxiao'),
            'wangyun'=>I('globals.wangyun'),
            'fortune'=>I('globals.fortune'),
            'arrzygua'=>I('globals.arrzygua'),
            'xiongji'=>$xj,
            'syarrzhux'=>I('globals.syarrzhux')[0]['zengyan'],
        );

        $json=json_encode($selectArr);
        echo $json;
    }
    public function bzsy(){//八字事业
        //接口
        $zymd=I('request.ymd');
        $hour=I('request.hour');
        $sex=I('request.sex');
        $orderid=I('request.orderid');
        $token=I('request.token');
        $channel=I('request.channel');

        $this->testing($zymd,$orderid,$token,'bzsy',$channel);

        //创建订单
        $hour=$hour;
        $shop=$orderid;
        $znickname='匿名';
        $zsex=$sex;if($zsex=='')$zsex=1;

        $this->insertOrder($zymd,$hour,$zsex,$shop,$znickname,$channel);


        if($sex==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($hour%2){$hour-=1;}
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'zw');
            $ssarray=array();
            array_push($ssarray,implode(I('globals.nianzhuss')));
            array_push($ssarray,implode(I('globals.yuezhuss')));
            array_push($ssarray,implode(I('globals.shizhuss')));
            $this->assign('nianzhuss',$ssarray);//十神

            liunian(I('globals.bznianzhu'));
            zsqk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'));
            $this->assign('mgarrzhux',I('globals.mgarrzhux'));//自身主星状况
            cyzk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('cbarrzhux',I('globals.cbarrzhux'));//财运主星状况
            syfz(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('syarrzhux',I('globals.syarrzhux'));//事业主星状况

            bzshiye(I('globals.sizhuny'),I('globals.shengxiao'),$zymd,I('globals.sizhu'),I('globals.wxsqs'));
            fortune(I('globals.shengxiao'),I('globals.bzrizhu'));
        }
        $mgarrzhux=I('globals.mgarrzhux');
        $sizhu=I('globals.sizhu');
        $arryysz=I('globals.arryysz');
        $sizhuny=I('globals.sizhuny');
        $bzshiye=I('globals.bzshiye');
        $mgarrzhux=I('globals.mgarrzhux');
        $syarrzhux=I('globals.syarrzhux');
        $shiyeys=I('globals.shiyeys');
        $bzguirenp=I('globals.bzguirenp');
        $shengxiaosh=I('globals.shengxiaosh');
        $arrwr=I('globals.arrwr');
        $xinggeArr=array(
            'youdian'=>$mgarrzhux[0]['youdian'],
            'quedian'=>$mgarrzhux[0]['quedian'],
            'zongping'=>array(
                0=>mb_substr($sizhu[2],0,1,'utf-8').mb_substr($sizhuny[2],2,1,'utf-8').'属'.$arryysz[2].mb_substr($sizhuny[2],2,1,'utf-8').'，为'.$sizhuny[2].'，'.$bzshiye['xinggezp1'],
                1=>$bzshiye['xinggezp2'],
                2=>$bzshiye['xinggezp3'],
                3=>$mgarrzhux[0]['zengyan'],
            ),
        );
        $shiyezhuliArr=array(
            0=>$syarrzhux[0]['quedian1'],
            1=>$syarrzhux[0]['quedian2'],
            2=>$syarrzhux[0]['zengyan'],
        );
        $selectArr=array(
            'sizhu'=>$sizhu,
            'nianzhuss'=>$ssarray,
            'canggan'=>I('globals.canggan'),
            'zhishen'=>I('globals.zhishen'),
            'sizhuny'=>I('globals.sizhuny'),
            'bzdishi'=>I('globals.bzdishi'),
            'wxsqs'=>I('globals.wxsqs'),
            'xiys'=>I('globals.xiys'),
            'xingge'=>$xinggeArr,
            'SYzhuli'=>$shiyezhuliArr,
            'direction'=>array($bzshiye['direction1'],$bzshiye['direction2'],$bzshiye['direction3']),
            'shiyeys'=>array($shiyeys[0],$shiyeys[1]),
            'guiren'=>array(
                0=>"八字贵人：你的朋友宜选择.".mb_substr($bzguirenp[0],0,1,'utf-8')."（".mb_substr($bzguirenp[0],1,1,'utf-8')."），".mb_substr($bzguirenp[1],0,1,'utf-8')."（".mb_substr($bzguirenp[1],1,1,'utf-8')."）年出生的人，他们是你的天乙贵人，在困难的时候往往能够帮你逢凶化吉。",
                1=>"你与{$shengxiaosh['dizhi1']}（{$shengxiaosh['namesh1']}）、{$shengxiaosh['dizhi2']}（{$shengxiaosh['namesh2']}）年生者三合，如果组团队一起做事业会有很大的助力。与辰（龙）年生者六合，遇到困难可以找他作为帮手，他对你存在先天的帮扶作用，能在事业上帮助到你。",
                2=>'从八字命盘来看，你的贵人方位在东南方、东北方，有助于催旺事业贵人运',
            ),
            'caifu'=>array(
                'congenital'=>I('globals.congenital'),
                'fortune'=>I('globals.fortune'),
            ),
            'arrwr'=>$arrwr,
        );
        $json=json_encode($selectArr);
        echo $json;
    }

    public function ysys(){//紫微斗数
        //接口
        $zymd=I('request.ymd');
        $hour=I('request.hour');
        $sex=I('request.sex');
        $orderid=I('request.orderid');
        $token=I('request.token');
        $channel=I('request.channel');

        $this->testing($zymd,$orderid,$token,'ysys',$channel);

        //创建订单
        $hour=$hour;
        $shop=$orderid;
        $znickname='匿名';
        $zsex=$sex;if($zsex=='')$zsex=1;

        $this->insertOrder($zymd,$hour,$zsex,$shop,$znickname,$channel);

        $y=mb_substr($zymd,0,4);//年
        $m=mb_substr($zymd,5,2); //月
        $d=mb_substr($zymd,8,2);//日
        $zyinli=yinli($y,$m,$d);
        cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时');//阳历
        cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2]);//阴历

        if($sex==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($hour%2){$hour-=1;}
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'zw');
            zsqk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'));
            hyqg(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            cyzk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            syfz(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            jkzt(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            jsdx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            znzk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            fmgx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            xdgx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            tzjj(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            rjgx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            qyfz(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            hualu(I('globals.shua'));
            $this->assign('hualu',I('globals.hualu'));//化禄
        }

        $dayunNum=I('globals.dayun');
        $sizhu=I('globals.sizhu');
        $selectArr=array(
            'tg'=>I('globals.tg'),//天干
            'srg'=>I('globals.srg'),//十二宫
            'arrzx'=>I('globals.arrzx'),//主星
            'arrtf'=>I('globals.arrtf'),//天府
            'syzx'=>I('globals.syzx'),//生月诸星
            'snzx'=>I('globals.snzx'),//生年支系诸星
            'sxzx'=>I('globals.sxzx'),//时系诸星
            'sngx'=>I('globals.sngx'),//生年干系诸星
            'snjq'=>I('globals.snjq'),//生年将前12星
            'snsq'=>I('globals.snsq'),//生年岁前12星
            'snbs'=>I('globals.snbs'),//生年博士12星
            'cssex'=>I('globals.cssex'),//长生12星
            'dx'=>I('globals.dx'),//大限
            'qtx'=>I('globals.qtx'),//其他星 如火星、铃星
            'xx'=>I('globals.xx'),//小限
            'shengxiao'=>I('globals.shengxiao'),
            'sizhu'=>I('globals.sizhu'),//Z四柱
            'dayun'=>array($dayunNum+1,$dayunNum+11,$dayunNum+21,$dayunNum+31,$dayunNum+41,$dayunNum+51,$dayunNum+61,$dayunNum+71),//大运
            'dayunx'=>I('globals.dayunx'),//大运x
            'dayuny'=>I('globals.dayuny'),//大运y
            'dayungz'=>I('globals.dayungz'),//大运干支
            'yangli'=>cookie('zyangli'),
            'yinli'=>cookie('zyinli').' '.mb_substr($sizhu[3],1,1,'utf-8').'时',
            'yysex'=>I('globals.yysex'),//阴阳男女
            'wxj'=>I('globals.wxj'),//五行局
            'smgong'=>I('globals.smgong'),//命身宫
            'mssnzx'=>I('globals.mssnzx'),//命身
            'shua'=>I('globals.shua'),//四化星
            'zsqk'=>array(
                'zsqkwz'=>I('globals.zsqkwz'),//自身情况
                'zsqkzx'=>I('globals.zsqkzx'),//自身主星
                'zsqkjx'=>I('globals.zsqkjx'),//自身吉星
                'zsqkxx'=>I('globals.zsqkxx'),//自身凶星
                'mggongwei'=>I('globals.mggongwei'),//自身宫位
                'mgxj'=>I('globals.mgxj'),//自身宫位凶吉
                'mgarrzhux'=>I('globals.mgarrzhux'),//自身主星状况
                'mgarrfuxz'=>I('globals.mgarrfuxz'),//自身副星状况坐命宫
                'mgarrfuxj'=>I('globals.mgarrfuxj'),//自身副星状况加会
            ),
            'hyqg'=>array(
                'hyqgwz'=>I('globals.hyqgwz'),//婚姻情感
                'hyqgzx'=>I('globals.hyqgzx'),//婚姻主星
                'hyqgjx'=>I('globals.hyqgjx'),//婚姻吉星
                'hyqgxx'=>I('globals.hyqgxx'),//婚姻凶星
                'fqgongwei'=>I('globals.fqgongwei'),//婚姻宫位
                'fqxj'=>I('globals.fqxj'),//婚姻宫位凶吉
                'fqarrzhux'=>I('globals.fqarrzhux'),//婚姻主星状况
                'fqarrfuxz'=>I('globals.fqarrfuxz'),//婚姻副星状况坐命宫
                'fqarrfuxj'=>I('globals.fqarrfuxj'),//婚姻副星状况加会
            ),
            'cyzk'=>array(
                'cyzkwz'=>I('globals.cyzkwz'),//财运状况
                'cyzkzx'=>I('globals.cyzkzx'),//财运主星
                'cyzkjx'=>I('globals.cyzkjx'),//财运吉星
                'cyzkxx'=>I('globals.cyzkxx'),//财运凶星
                'cbgongwei'=>I('globals.cbgongwei'),//财运宫位
                'cbxj'=>I('globals.cbxj'),//财运宫位凶吉
                'cbarrzhux'=>I('globals.cbarrzhux'),//财运主星状况
                'cbarrfuxz'=>I('globals.cbarrfuxz'),//财运副星状况坐命宫
                'cbarrfuxd'=>I('globals.cbarrfuxd'),//财运副星状况对照
                'cbarrfuxj'=>I('globals.cbarrfuxj'),//财运副星状况加会
            ),
            'syfz'=>array(
                'syfzwz'=>I('globals.syfzwz'),//事业状况
                'syfzzx'=>I('globals.syfzzx'),//事业主星
                'syfzjx'=>I('globals.syfzjx'),//事业吉星
                'syfzxx'=>I('globals.syfzxx'),//事业凶星
                'sygongwei'=>I('globals.sygongwei'),//事业宫位
                'syxj'=>I('globals.syxj'),//事业宫位凶吉
                'syarrzhux'=>I('globals.syarrzhux'),//事业主星状况
                'syarrfuxz'=>I('globals.syarrfuxz'),//事业副星状况坐命宫
                'syarrfuxd'=>I('globals.syarrfuxd'),//事业副星状况对照
                'syarrfuxj'=>I('globals.syarrfuxj'),//事业副星状况加会
            ),
            'jkzt'=>array(
                'jkztwz'=>I('globals.jkztwz'),//疾厄状况
                'jkztzx'=>I('globals.jkztzx'),//疾厄主星
                'jkztjx'=>I('globals.jkztjx'),//疾厄吉星
                'jkztxx'=>I('globals.jkztxx'),//疾厄凶星
                'jegongwei'=>I('globals.jegongwei'),//疾厄宫位
                'jexj'=>I('globals.jexj'),//疾厄宫位凶吉
                'jearrzhux'=>I('globals.jearrzhux'),//疾厄主星状况
                'jearrfuxz'=>I('globals.jearrfuxz'),//疾厄副星状况坐命宫
                'jearrfuxd'=>I('globals.jearrfuxd'),//疾厄副星状况对照
                'jearrfuxj'=>I('globals.jearrfuxj'),//疾厄副星状况加会
            ),
            'jsdx'=>array(
                'jsdxwz'=>I('globals.jsdxwz'),//福德状况
                'jsdxzx'=>I('globals.jsdxzx'),//福德主星
                'jsdxjx'=>I('globals.jsdxjx'),//福德吉星
                'jsdxxx'=>I('globals.jsdxxx'),//福德凶星
                'fdgongwei'=>I('globals.fdgongwei'),//福德宫位
                'fdxj'=>I('globals.fdxj'),//福德宫位凶吉
                'fdarrzhux'=>I('globals.fdarrzhux'),//福德主星状况
                'fdarrfuxz'=>I('globals.fdarrfuxz'),//福德副星状况坐命宫
                'fdarrfuxd'=>I('globals.fdarrfuxd'),//福德副星状况对照
                'fdarrfuxj'=>I('globals.fdarrfuxj'),//福德副星状况加会
            ),
            'znzk'=>array(
                'znzkwz'=>I('globals.znzkwz'),//子女状况
                'znzkzx'=>I('globals.znzkzx'),//子女主星
                'znzkjx'=>I('globals.znzkjx'),//子女吉星
                'znzkxx'=>I('globals.znzkxx'),//子女凶星
                'zngongwei'=>I('globals.zngongwei'),//子女宫位
                'znxj'=>I('globals.znxj'),//子女宫位凶吉
                'znarrzhux'=>I('globals.znarrzhux'),//子女主星状况
                'znarrfuxz'=>I('globals.znarrfuxz'),//子女副星状况坐命宫
                'znarrfuxd'=>I('globals.znarrfuxd'),//子女副星状况对照
                'znarrfuxj'=>I('globals.znarrfuxj'),//子女副星状况加会
            ),
            'fmgx'=>array(
                'fmgxwz'=>I('globals.fmgxwz'),//父母状况
                'fmgxzx'=>I('globals.fmgxzx'),//父母主星
                'fmgxjx'=>I('globals.fmgxjx'),//父母吉星
                'fmgxxx'=>I('globals.fmgxxx'),//父母凶星
                'fmgongwei'=>I('globals.fmgongwei'),//父母宫位
                'fmxj'=>I('globals.fmxj'),//父母宫位凶吉
                'fmarrzhux'=>I('globals.fmarrzhux'),//父母主星状况
                'fmarrfuxz'=>I('globals.fmarrfuxz'),//父母副星状况坐命宫
                'fmarrfuxd'=>I('globals.fmarrfuxd'),//父母副星状况对照
                'fmarrfuxj'=>I('globals.fmarrfuxj'),//父母副星状况加会
            ),
            'xdgx'=>array(
                'xdgxwz'=>I('globals.xdgxwz'),//兄弟状况
                'xdgxzx'=>I('globals.xdgxzx'),//兄弟主星
                'xdgxjx'=>I('globals.xdgxjx'),//兄弟吉星
                'xdgxxx'=>I('globals.xdgxxx'),//兄弟凶星
                'xdgongwei'=>I('globals.xdgongwei'),//兄弟宫位
                'xdxj'=>I('globals.xdxj'),//兄弟宫位凶吉
                'xdarrzhux'=>I('globals.xdarrzhux'),//兄弟主星状况
                'xdarrfuxz'=>I('globals.xdarrfuxz'),//兄弟副星状况坐命宫
                'xdarrfuxd'=>I('globals.xdarrfuxd'),//兄弟副星状况对照
                'xdarrfuxj'=>I('globals.xdarrfuxj'),//兄弟副星状况加会
            ),
            'tzjj'=>array(
                'tzjjwz'=>I('globals.tzjjwz'),//田宅状况
                'tzjjzx'=>I('globals.tzjjzx'),//田宅主星
                'tzjjjx'=>I('globals.tzjjjx'),//田宅吉星
                'tzjjxx'=>I('globals.tzjjxx'),//田宅凶星
                'tzgongwei'=>I('globals.tzgongwei'),//田宅宫位
                'tzxj'=>I('globals.tzxj'),//田宅宫位凶吉
                'tzarrzhux'=>I('globals.tzarrzhux'),//田宅主星状况
                'tzarrfuxz'=>I('globals.tzarrfuxz'),//田宅副星状况坐命宫
                'tzarrfuxd'=>I('globals.tzarrfuxd'),//田宅副星状况对照
                'tzarrfuxj'=>I('globals.tzarrfuxj'),//田宅副星状况加会
            ),
            'rjgx'=>array(
                'rjgxwz'=>I('globals.rjgxwz'),//部署状况
                'rjgxzx'=>I('globals.rjgxzx'),//部署主星
                'rjgxjx'=>I('globals.rjgxjx'),//部署吉星
                'rjgxxx'=>I('globals.rjgxxx'),//部署凶星
                'bsgongwei'=>I('globals.bsgongwei'),//部署宫位
                'bsxj'=>I('globals.bsxj'),//部署宫位凶吉
                'bsarrzhux'=>I('globals.bsarrzhux'),//部署主星状况
                'bsarrfuxz'=>I('globals.bsarrfuxz'),//部署副星状况坐命宫
                'bsarrfuxd'=>I('globals.bsarrfuxd'),//部署副星状况对照
                'bsarrfuxj'=>I('globals.bsarrfuxj'),//部署副星状况加会
            ),
            'qyfz'=>array(
                'qyfzwz'=>I('globals.qyfzwz'),//迁移状况
                'qyfzzx'=>I('globals.qyfzzx'),//迁移主星
                'qyfzjx'=>I('globals.qyfzjx'),//迁移吉星
                'qyfzxx'=>I('globals.qyfzxx'),//迁移凶星
                'qygongwei'=>I('globals.qygongwei'),//迁移宫位
                'qyxj'=>I('globals.qyxj'),//迁移宫位凶吉
                'qyarrzhux'=>I('globals.qyarrzhux'),//迁移主星状况
                'qyarrfuxz'=>I('globals.qyarrfuxz'),//迁移副星状况坐命宫
                'qyarrfuxd'=>I('globals.qyarrfuxd'),//迁移副星状况对照
                'qyarrfuxj'=>I('globals.qyarrfuxj'),//迁移副星状况加会
            ),
        );
        $json=json_encode($selectArr);
        echo $json;
    }

    public function qmcs(){//起名接口
        $ymd=$_REQUEST['ymd'];
        $hour=$_REQUEST['hour'];
        $sex=$_REQUEST['sex'];
        $surname=$_REQUEST['surname'];

        judgeData(array($ymd,$hour),$_REQUEST);

        $ymdArr=explode('-',$ymd);
        $y=$ymdArr[0];$m=$ymdArr[1];$d=$ymdArr[2];
        cookie('zymd',$ymd);

        if($sex==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($ymd!='') {
            zwmp($ymd,$hour,$zsex,'NOdayun');
            $lnlylr=I('globals.lnlylr');
            $shengxiao=I('globals.shengxiao');//生肖
            $sizhu=I('globals.sizhu');//Z四柱
            $ssarray = array();
            array_push($ssarray, implode(I('globals.nianzhuss')));
            array_push($ssarray, implode(I('globals.yuezhuss')));
            array_push($ssarray, implode(I('globals.shizhuss')));
            $this->assign('nianzhuss', $ssarray);//十神
            $this->assign('canggan', I('globals.canggan'));//藏干
            $this->assign('zhishen', I('globals.zhishen'));//支神
            $this->assign('sizhuny', I('globals.sizhuny'));//四柱纳音
            $this->assign('bzdishi', I('globals.bzdishi'));//八字地势
            $wxsqs=I('globals.wxsqs');//旺相休囚死
            $xiys=I('globals.xiys');//喜用神

            $zhanxing=new \Library\ZhanXing();
            $constellation=$zhanxing->constellation($m,$d);//获取星座

            $qiming=new \Library\QiMing();
            $qimingData=$qiming->qimingData($xiys,$wxsqs,$shengxiao,$constellation,$sex);
            $wuxingScore=$qiming->wuxingScore($sizhu);
            $scWgScore=$qiming->scWgScore($ymd,$hour,$qimingData);

            $arr=array(
                'sizhu'=>$sizhu,
                'qimingData'=>$qimingData,//起名数据
                'wuxingScore'=>$wuxingScore,//五行得分
                'scWgScore'=>$scWgScore,//三才五格得分
            );
        }
        echo json_encode($arr,JSON_UNESCAPED_UNICODE);
    }

    public function circularZW(){//紫微地图数据
        $zymd=$_REQUEST['ymd'];
        $hour=$_REQUEST['hour'];
        $sex=$_REQUEST['sex'];
        if($zymd){
        }else{
            echo '缺少参数';exit;
        }
        $ymdArr=explode('-',$zymd);
        $y=$ymdArr[0];
        $m=$ymdArr[1];
        $d=$ymdArr[2];
        $zyinli=yinli($y,$m,$d);
        cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.$hour.'时');//阳历
        cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2]);//阴历
        if($sex==1){$zsex='男';
        }else{$zsex='女';}
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'zw');
            $sizhu=I('globals.sizhu');//Z四柱
        }
        $dizhi=array('0','子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥');//地支
        $nz=array_search(mb_substr($sizhu[0],1,1,'utf-8'),$dizhi);
        $yz=array_search(mb_substr($sizhu[1],1,1,'utf-8'),$dizhi);
        $rz=array_search(mb_substr($sizhu[2],1,1,'utf-8'),$dizhi);

        $arrzx=I('globals.arrzx');$arrtf=I('globals.arrtf');$syzx=I('globals.syzx');$sxzx=I('globals.sxzx');$srg=I('globals.srg');$sngx=I('globals.sngx');
        $snzx=I('globals.snzx');$snjq=I('globals.snjq');$snsq=I('globals.snsq');$snbs=I('globals.snbs');$cssex=I('globals.cssex');
        $qtx=I('globals.qtx');

        zwmp(date('Y-m-d'),$hour,$zsex,'sizhu');
        $todaySizhu=I('globals.sizhu');//今日四柱
        $lnSnsq=todaySnsq($todaySizhu);//今天生年岁前
        $lnSngx=todaySngx($todaySizhu);//今天生年干系诸星

        $ziweiArr=array(
            '紫微'=>'独尊', '天府'=>'财库', '天机'=>'心思', '太阳'=>'阳光、男性', '太阴'=>'阴柔、女性', '天同'=>'清闲', '天梁'=>'解难', '廉贞'=>'清白、脓血', '贪狼'=>'欲望', '天相'=>'辅佐', '破军'=>'动荡', '七杀'=>'肃杀', '巨门'=>'口舌', '武曲'=>'行动', '文曲'=>'才艺', '文昌'=>'文昌',
            '天魁'=>'阳贵人','天钺'=>'阴贵人', '禄存'=>'财星', '天马'=>'奔波', '擎羊'=>'伤害', '陀罗'=>'迟滞', '地空'=>'虚无', '地劫'=>'跌落', '左辅'=>'助力', '右弼'=>'助力', '火星'=>'急速', '铃星'=>'警戒', '红鸾'=>'桃花', '天喜'=>'喜气', '阴煞'=>'诡异', '天姚'=>'浪荡', '晦气'=>'晦气', '丧门'=>'丧门', '贯索'=>'束缚', '官符'=>'官非', '小耗'=>'小破费', '大耗'=>'大破费', '龙德'=>'化解', '白虎'=>'白虎', '天德'=>'庇佑', '吊客'=>'吊客', '病符'=>'疾病', '岁建'=>'岁建',
        );
        foreach($lnSnsq as $key=>$value){
            foreach($value as $k=>$v){
                if($ziweiArr[$v]){
                    $lnSnsq[$key][$k]=$ziweiArr[$v];
                }
            }
        }

        foreach($lnSngx as $key=>$value){
            foreach($value as $k=>$v){
                if(mb_strlen($v,'utf-8')>2){
                    $strData1=mb_substr($v,0,2,'utf-8');
                    $strData2=mb_substr($v,2,2,'utf-8');
                    $lnSngx[$key][$k]=$ziweiArr[$strData1].'/'.$ziweiArr[$strData2];
                }
                if($ziweiArr[$v]){
                    $lnSngx[$key][$k]=$ziweiArr[$v];
                }
            }
        }

        $ziweiGong=array();
        for($i=0;$i<=11;$i++){
            $number=array(10,11,0,1,2,3,4,5,6,7,8,9);
            $dizhi=array('寅','卯','辰','巳','午','未','申','酉','戌','亥','子','丑',);
            $key=$i;$keyNum=$i;
            $ziweiGong[$i][0]=$dizhi[$key];

            $qtx1=mb_substr($qtx[$key],0,2,'utf-8');$qtx2=mb_substr($qtx[$key],3,2,'utf-8');$syzx1=mb_substr($syzx[$key],0,2,'utf-8');$syzx2=mb_substr($syzx[$key],3,2,'utf-8');
            $snzx1=mb_substr($snzx[$key],0,2,'utf-8');$snzx2=mb_substr($snzx[$key],3,2,'utf-8');$sngx1=mb_substr($sngx[$key],0,2,'utf-8');$sngx2=mb_substr($sngx[$key],3,2,'utf-8');
            $sxzx1=mb_substr($sxzx[$key],0,2,'utf-8');$sxzx2=mb_substr($sxzx[$key],3,2,'utf-8');$sxzx3=mb_substr($sxzx[$key],6,2,'utf-8');$sxzx4=mb_substr($sxzx[$key],9,2,'utf-8');
            $arrzx[$key]=mb_substr($arrzx[$key],0,2,'utf-8');
            $arrtf[$key]=mb_substr($arrtf[$key],0,2,'utf-8');
            $data1=array($arrzx[$key],$arrtf[$key],$qtx1,$qtx2,$syzx1,$syzx2,$snzx1,$snzx2,$sngx1,$sngx2,$sxzx1,$sxzx2,$sxzx3,$sxzx4,$snsq[$key]);

            $data1=array_filter($data1);
            foreach($data1 as $key=>$value){
                if($ziweiArr[$value]){
                    $data1[$key]=$ziweiArr[$value];
                }else{
                    $data1[$key]='';
                }
            }
            $ziweiGong[$i][1]=array_filter($data1);

            $snsqBF=array();
            foreach($snsq as $key=>$value){
                if($ziweiArr[$value]){$snsqBF[$key]=$ziweiArr[$value];
                }else{}
            }

            $ziweiGong[$i][2][0]=$lnSnsq['lnSnsq'][$keyNum];
            $ziweiGong[$i][3][0]=$lnSnsq['lySnsq'][$keyNum];
            $ziweiGong[$i][4][0]=$lnSnsq['lrSnsq'][$keyNum];

            $ziweiGong[$i][2][1]=$lnSngx['lnSngx'][$keyNum];
            $ziweiGong[$i][3][1]=$lnSngx['lySngx'][$keyNum];
            $ziweiGong[$i][4][1]=$lnSngx['lrSngx'][$keyNum];
        }

        $ziweiGongArr=array();
        foreach($ziweiGong as $key=>$value){
            $dizhiData=array('子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥');
            $key=array_search($value[0],$dizhiData);

            if($key==1||$key==2||$key==5||$key==6||$key==9||$key==10){
               $colorArr=array(
                   'fafea7',
                   'e84828',
                   'fafea7',
               );
            }else{
                $colorArr=array(
                    'e84828',
                    '79bedb',
                    'e84828',
                );
            }
            $ziweiGongArr[$key]['id']=$key+1;
            $ziweiGongArr[$key]['time']=$value[0];
            $ziweiGongArr[$key]['color']=$colorArr[0];
            $ziweiGongArr[$key]['list']=array(
                array('color'=>'baf8fe','content'=>implode('/',array_filter($value[1]))),
                array('color'=>$colorArr[1],'content'=>implode('/',array_filter($value[2]))),
                array('color'=>'fdbfc4','content'=>implode('/',array_filter($value[3]))),
                array('color'=>$colorArr[2],'content'=>implode('/',array_filter($value[4]))),
            );
        }
        ksort($ziweiGongArr);
        //dump($ziweiGongArr);

        echo json_encode($ziweiGongArr);
    }
    public function circularZWtime(){//宫位数据
        $zymd=$_REQUEST['ymd'];
        $hour=$_REQUEST['hour'];
        $sex=$_REQUEST['sex'];
        $Gdizhi=$_REQUEST['time'];
        if($zymd&&$hour&&$sex&&$Gdizhi){
        }else{
            echo '缺少参数';exit;
        }
        $ymdArr=explode('-',$zymd);
        $y=$ymdArr[0];
        $m=$ymdArr[1];
        $d=$ymdArr[2];
        $zyinli=yinli($y,$m,$d);
        cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.$hour.'时');//阳历
        cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2]);//阴历
        if($sex==1){$zsex='男';
        }else{$zsex='女';}
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'zw');
            $sizhu=I('globals.sizhu');//Z四柱
        }
        $dizhiGW=array('寅','卯','辰','巳','午','未','申','酉','戌','亥','子','丑');
        $dzWZ=array_search($Gdizhi,$dizhiGW);

        $tg=I('globals.tg');//天干
        $srg=I('globals.srg');//十二宫
        $arrzx=I('globals.arrzx');//主星
        $arrtf=I('globals.arrtf');//天府
        $syzx=I('globals.syzx');//生月诸星
        $snzx=I('globals.snzx');//生年支系诸星
        $sxzx=I('globals.sxzx');//时系诸星
        $sngx=I('globals.sngx');//生年干系诸星
        $snjq=I('globals.snjq');//生年将前12星
        $snsq=I('globals.snsq');//生年岁前12星
        $snbs=I('globals.snbs');//生年博士12星
        $cssex=I('globals.cssex');//长生12星
        $qtx=I('globals.qtx');//其他星 如火星、铃星
        $dx=I('globals.dx');//大限
        $xx=I('globals.xx');//小限

        $zhuArr=array(
            $arrzx[$dzWZ],
            $arrtf[$dzWZ],
            mb_substr($syzx[$dzWZ],0,2,'utf-8'),
            mb_substr($syzx[$dzWZ],3,2,'utf-8'),
            mb_substr($snzx[$dzWZ],0,2,'utf-8'),
            mb_substr($snzx[$dzWZ],3,2,'utf-8'),
            mb_substr($sxzx[$dzWZ],0,2,'utf-8'),
            mb_substr($sxzx[$dzWZ],3,2,'utf-8'),
            mb_substr($sngx[$dzWZ],0,2,'utf-8'),
            mb_substr($sngx[$dzWZ],3,2,'utf-8'),
            mb_substr($qtx[$dzWZ],0,2,'utf-8'),
            mb_substr($qtx[$dzWZ],3,2,'utf-8'),
            mb_substr($qtx[$dzWZ],6,2,'utf-8'),
        );
        $zhuArr=array_values(array_filter($zhuArr));
        $arr=array(
            'gongwei'=>$srg[$dzWZ],
            'time'=>$tg[$dzWZ].$Gdizhi,
            'dx'=>$dx[$dzWZ],
            'xx'=>$xx[$dzWZ],
            'zhuxing'=>$zhuArr,
            'fourxing'=>array(
                $snjq[$dzWZ],
                $snsq[$dzWZ],
                $snbs[$dzWZ],
                $cssex[$dzWZ],
            ),
        );
        //dump($arr);
        echo json_encode($arr);
    }
    public function circularZWmingpan(){//命盘数据获取
        $zymd=$_REQUEST['ymd'];
        $hour=$_REQUEST['hour'];
        $sex=$_REQUEST['sex'];
        if($zymd&&$hour&&$sex){
        }else{
            echo '缺少参数';exit;
        }
        $ymdArr=explode('-',$zymd);
        $y=$ymdArr[0];
        $m=$ymdArr[1];
        $d=$ymdArr[2];
        $zyinli=yinli($y,$m,$d);

        if($sex==1){$zsex='男';
        }else{$zsex='女';}
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'zw');
            $sizhu=I('globals.sizhu');//Z四柱
            $yysex=I('globals.yysex');//阴阳男女
            $wxj=I('globals.wxj');//五行局
            $smgong=I('globals.smgong');//命身宫
            $mssnzx=I('globals.mssnzx');//命身主
            $shua=I('globals.shua');//四化星
        }
        $yangli=$y.'年'.intval($m).'月'.intval($d).'日'.' '.$hour.'时';//阳历
        $yinli=$zyinli[0].'年'.$zyinli[1].$zyinli[2].' '.mb_substr($sizhu[3],1,1,'utf-8')."时";//阴历

        $Arr=array(
            'sizhu'=>$sizhu,
            'yangli'=>$yangli,
            'yinli'=>$yinli,
            'sex'=>$yysex,
            'mingju'=>$wxj,
            'minggong'=>mb_substr($smgong,0,1,'utf-8'),
            'shengong'=>mb_substr($smgong,1,1,'utf-8'),
            'mingzhu'=>$mssnzx[13],
            'shenzhu'=>$mssnzx[14],
            'lu'=>$shua[0]['hlu'],
            'quan'=>$shua[0]['hquan'],
            'ke'=>$shua[0]['hke'],
            'ji'=>$shua[0]['hji'],
        );
        //dump($Arr);
        echo json_encode($Arr);

    }

    public function interfaceWechatPay(){//共用微信接口支付
        if($_REQUEST['getTokenType']){
            cookie('getTokenType',$_REQUEST['getTokenType']);
        }
        if($_REQUEST['orderid']){
            $orderid=$_REQUEST['orderid'];
            cookie('orderid',$_REQUEST['orderid']);
            cookie('csName',$_REQUEST['csName']);
            cookie('jumpUrl',$_REQUEST['jumpUrl']);
            cookie('returnUrl',$_REQUEST['returnUrl']);
            cookie('price',$_REQUEST['price']);
            cookie('notifyUrl',$_REQUEST['notifyUrl']);
            S("JC{$orderid}",$_REQUEST,600);
        }else if($_REQUEST['ordernum']){
            $orderData=S("JC{$_REQUEST['ordernum']}");
            cookie('orderid',$orderData['orderid']);
            cookie('csName',$orderData['csName']);
            cookie('jumpUrl',$orderData['jumpUrl']);
            cookie('returnUrl',$orderData['returnUrl']);
            cookie('price',$orderData['price']);
            cookie('notifyUrl',$orderData['notifyUrl']);
        }

        getToken();
        getTicket();
        $wzurl = wxJsdkData();
        if (!empty($_REQUEST['code'])) {
            cookie('code', $_REQUEST['code'], 7100);
        }
        getCode($wzurl);
        getOopenid();
        $openid=cookie('openid');

        if($_SERVER['HTTP_HOST']=='wx1.bazijingpi.top'){//支付域名执行
            cookie('openid',$_REQUEST['openid']);
        }
        if($_SERVER['HTTP_HOST']=='wx1.zmweb.top'){//授权域名
            redirect("http://wx1.bazijingpi.top/zhiming/index.php/Home-Interface-interfaceWechatPay?openid={$openid}&ordernum={$orderid}");
        }


        $orderid=cookie('orderid');
        $csName=cookie('csName');
        $jumpUrl=cookie('jumpUrl');
        $returnUrl=cookie('returnUrl');
        $notifyUrl=cookie('notifyUrl');

        $this->assign('wxLogin',1);
        $xml=wxgzhzfInterface($csName,$orderid,$notifyUrl);//公众号支付回调参数
        $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
        $val = json_decode(json_encode($xmlstring),true);

        if(empty($val['prepay_id'])){
            cookie('code',null);
            cookie('openid',null);
            redirect($wzurl);
            dump($val);exit;
        }
        $noncestr=noncestr(15);//随机字符串
        $timestamp=time();//时间戳
        $APPID=cookie('APPID');

        $stringA="appId={$APPID}&nonceStr={$noncestr}&package=prepay_id={$val['prepay_id']}&signType=MD5&timeStamp={$timestamp}";
        $stringSignTemp=$stringA."&key=".cookie('wxKEY');
        $sign=strtoupper(md5($stringSignTemp));

        $this->assign('timeStamp',$timestamp);
        $this->assign('nonceStr',$noncestr);
        $this->assign('package','prepay_id='.$val['prepay_id']);
        $this->assign('signType','MD5');
        $this->assign('paySign',$sign);
        $this->assign('appId',$APPID);
        $this->assign('jumpUrl',$jumpUrl);
        $this->assign('returnUrl',$returnUrl);
        $this->display("Index/paywx");
    }

    public function remain(){//留存统计
        $baseNum=dataBaseNum();
        if(empty($baseNum)){//终止执行
            return $baseNum;
        }

        $typeName=$_REQUEST['typeName'];
        $nickName=$_REQUEST['nickName'];
        $channel=$_REQUEST['channel'];
        $homeNUm=$_REQUEST['homeNUm'];
        if($_REQUEST['uid']&&$_REQUEST['uid']!='undefined'){
            $ip=$_REQUEST['uid'];
        }else{
            $ip=$_SERVER['REMOTE_ADDR'];
            //$ip='192.168.1.2';
            $ip=str_replace('.','',$ip);
        }

        judgeData(array($typeName,$ip),$_REQUEST);
        echo 1;

        if($channel=='qudao138'||$homeNUm==1){
            exit;
        }

        $date=date('Ymd');

        //添加类型
        if(S($typeName)){
            $tid=S($typeName);
        }else{
            S($typeName,1,604800);
            $typeArr=M()->query("select tid from remain_type_name where typeName='{$typeName}'");
            if(empty($typeArr)){
                M()->query("insert into remain_type_name (typeName,nickName)values('{$typeName}','{$nickName}')");
                $tid=mysql_insert_id();
                S($typeName,$tid,604800);
            }else{
                $tid=$typeArr[0]['tid'];
                S($typeName,$tid,604800);
            }
        }
        if(S($ip.'remain'.$tid)){
            exit;
        }

        //用户ip信息记录
        $ipTidDate=S($ip.$tid.$date);
        if(empty($ipTidDate)){
            S($ip.$tid.$date,1,604800);//保存7天
            $remainIpNumber=S($tid.$date.$channel.'remainIpNumber');//当天类型uv人数
            S($tid.$date.$channel.'remainIpNumber',$remainIpNumber+1,86400);
        }else{
            exit;//有执行过，结束
        }

        //当前留存表记录
        $dateDataTid=S('remainDateData'.$date.$tid.$channel);
        if(empty($dateDataTid)){
            M()->query("insert into remain_date_data (date,tid,channel)values('{$date}','{$tid}','{$channel}')");
            $did=mysql_insert_id();
            S('remainDateData'.$date.$tid.$channel,$did,86400);
        }else{
            $did=$dateDataTid;
        }

        //number更新
        if(S('remainNumber'.$tid)){

        }else{
            S('remainNumber'.$tid,1,300);
            $remainIpNumber=S($tid.$date.$channel.'remainIpNumber');//当天类型uv人数
            M()->query("update remain_date_data set number='{$remainIpNumber}' where id='{$did}'");
        }

        $date1=date('Ymd',strtotime('-1 day'));//前一天
        $date2=date('Ymd',strtotime('-2 day'));
        $date3=date('Ymd',strtotime('-3 day'));
        $date4=date('Ymd',strtotime('-4 day'));
        $date5=date('Ymd',strtotime('-5 day'));
        $date6=date('Ymd',strtotime('-6 day'));
        $date7=date('Ymd',strtotime('-7 day'));

        $ipData1=S($ip.$tid.$date1);
        if($ipData1){
            $remainDateData=S('remain_date_data'.$date1.$tid.$channel);$remainDateDataNumber=S('remain_date_data'.$date1.$tid.$channel.'Number');
            if(empty($remainDateData)){
                S('remain_date_data'.$date1.$tid.$channel,1,300);
                $dateDataArr=M()->query("select id,remain1 from remain_date_data where date='{$date1}' and tid='{$tid}' and channel='{$channel}'");
                M()->query("update remain_date_data set remain1='{$remainDateDataNumber}'+1 where id='{$dateDataArr[0]['id']}'");
            }
            S('remain_date_data'.$date1.$tid.$channel.'Number',$remainDateDataNumber+1,604800);S($ip.$tid.$date1,null);
        }

        $ipData1=S($ip.$tid.$date2);
        if($ipData1){
            $remainDateData=S('remain_date_data'.$date2.$tid.$channel);$remainDateDataNumber=S('remain_date_data'.$date2.$tid.$channel.'Number');
            if(empty($remainDateData)){
                S('remain_date_data'.$date2.$tid.$channel,1,300);
                $dateDataArr=M()->query("select id,remain2 from remain_date_data where date='{$date2}' and tid='{$tid}' and channel='{$channel}'");
                M()->query("update remain_date_data set remain2='{$remainDateDataNumber}'+1 where id='{$dateDataArr[0]['id']}'");
            }
            S('remain_date_data'.$date2.$tid.$channel.'Number',$remainDateDataNumber+1,604800);S($ip.$tid.$date2,null);
        }

        $ipData1=S($ip.$tid.$date3);
        if($ipData1){
            $remainDateData=S('remain_date_data'.$date3.$tid.$channel);$remainDateDataNumber=S('remain_date_data'.$date3.$tid.$channel.'Number');
            if(empty($remainDateData)){
                S('remain_date_data'.$date3.$tid.$channel,1,300);
                $dateDataArr=M()->query("select id,remain3 from remain_date_data where date='{$date3}' and tid='{$tid}' and channel='{$channel}'");
                M()->query("update remain_date_data set remain3='{$remainDateDataNumber}'+1 where id='{$dateDataArr[0]['id']}'");
            }
            S('remain_date_data'.$date3.$tid.$channel.'Number',$remainDateDataNumber+1,604800);S($ip.$tid.$date3,null);
        }

        $ipData1=S($ip.$tid.$date4);
        if($ipData1){
            $remainDateData=S('remain_date_data'.$date4.$tid.$channel);$remainDateDataNumber=S('remain_date_data'.$date4.$tid.$channel.'Number');
            if(empty($remainDateData)){
                S('remain_date_data'.$date4.$tid.$channel,1,300);
                $dateDataArr=M()->query("select id,remain4 from remain_date_data where date='{$date4}' and tid='{$tid}' and channel='{$channel}'");
                M()->query("update remain_date_data set remain4='{$remainDateDataNumber}'+1 where id='{$dateDataArr[0]['id']}'");
            }
            S('remain_date_data'.$date4.$tid.$channel.'Number',$remainDateDataNumber+1,604800);S($ip.$tid.$date4,null);
        }

        $ipData1=S($ip.$tid.$date5);
        if($ipData1){
            $remainDateData=S('remain_date_data'.$date5.$tid.$channel);$remainDateDataNumber=S('remain_date_data'.$date5.$tid.$channel.'Number');
            if(empty($remainDateData)){
                S('remain_date_data'.$date5.$tid.$channel,1,300);
                $dateDataArr=M()->query("select id,remain5 from remain_date_data where date='{$date5}' and tid='{$tid}' and channel='{$channel}'");
                M()->query("update remain_date_data set remain5='{$remainDateDataNumber}'+1 where id='{$dateDataArr[0]['id']}'");
            }
            S('remain_date_data'.$date5.$tid.$channel.'Number',$remainDateDataNumber+1,604800);S($ip.$tid.$date5,null);
        }

        $ipData1=S($ip.$tid.$date6);
        if($ipData1){
            $remainDateData=S('remain_date_data'.$date6.$tid.$channel);$remainDateDataNumber=S('remain_date_data'.$date6.$tid.$channel.'Number');
            if(empty($remainDateData)){
                S('remain_date_data'.$date6.$tid.$channel,1,300);
                $dateDataArr=M()->query("select id,remain6 from remain_date_data where date='{$date6}' and tid='{$tid}' and channel='{$channel}'");
                M()->query("update remain_date_data set remain6='{$remainDateDataNumber}'+1 where id='{$dateDataArr[0]['id']}'");
            }
            S('remain_date_data'.$date6.$tid.$channel.'Number',$remainDateDataNumber+1,604800);S($ip.$tid.$date6,null);
        }

        $ipData1=S($ip.$tid.$date7);
        if($ipData1){
            $remainDateData=S('remain_date_data'.$date7.$tid.$channel);$remainDateDataNumber=S('remain_date_data'.$date7.$tid.$channel.'Number');
            if(empty($remainDateData)){
                S('remain_date_data'.$date7.$tid.$channel,1,300);
                $dateDataArr=M()->query("select id,remain7 from remain_date_data where date='{$date7}' and tid='{$tid}' and channel='{$channel}'");
                M()->query("update remain_date_data set remain7='{$remainDateDataNumber}'+1 where id='{$dateDataArr[0]['id']}'");
            }
            S('remain_date_data'.$date7.$tid.$channel.'Number',$remainDateDataNumber+1,604800);S($ip.$tid.$date7,null);
        }
    }

    public function wuxingScore(){//返回五行强度 个数
        $ymd=$_REQUEST['ymd'];
        $hour=$_REQUEST['hour'];
        judgeData(array($ymd),$_REQUEST);
        zwmp($ymd,$hour,1,'sizhu');
        $sizhu=I('globals.sizhu');
        $shengxiao=I('globals.shengxiao');//生肖
        if($shengxiao=='猪'){$ftxData='值太岁';
        }else if($shengxiao=='猴'){$ftxData='害太岁';
        }else if($shengxiao=='蛇'){$ftxData='冲太岁';
        }else if($shengxiao=='虎'){$ftxData='破太岁';
        }else{$ftxData='';}

        $qiming=new \Library\QiMing();
        $wuxingScore=$qiming->wuxingScore($sizhu);
        $arr=$wuxingScore['wuxingNumArr'];
        $arr['wuxingNumber']=$wuxingScore['wuxingNumber'];
        $arr['shengxiao']=$shengxiao;
        $arr['fts']=$ftxData;
        $arr['bazi']=$sizhu;
        echo json_encode($arr,JSON_UNESCAPED_UNICODE);
    }
    public function everydayYs(){//每日运势接口数据
        $birthday=I('request.birthday');//2019-08-08
        $sex=I('request.sex');
        $name=I('request.name');
        judgeData(array($birthday),$_REQUEST);

        $ymdArr=explode('-',$birthday);
        $y=$ymdArr[0];//年
        $m=$ymdArr[1];//月
        $d=$ymdArr[2];//日

        for($i=0;$i<7;$i++){
            $date=date('Y-m-d',strtotime("+{$i} day",time()));
            $dateArr=explode('-',$date);
            $yNum=$dateArr[0];
            $mNum=$dateArr[1];
            $dNum=$dateArr[2];
            $everydayNum=$yNum+$mNum*$dNum;
            $id=($m*$d+$y+$everydayNum)%109;
            if($id==0)$id=1;
            $riArr=M()->query("select * from qc_constellation_ri where id='{$id}'");
            $zongheNum=intval(($riArr[0]['aiqing_num']+$riArr[0]['shiye_num']+$riArr[0]['caifu_num']+$riArr[0]['jiankang_num'])/4);
            $riArr[0]['zonghe_num']=$zongheNum;

            zwmp($date,0,1,'sizhu');
            $sizhu=I('globals.sizhu');
            $fangwei=everydayCy(mb_substr($sizhu[2],0,1,'utf-8'));
            $food=everydayFood(mb_substr($sizhu[2],0,1,'utf-8'),$date,$birthday);
            $riArr[0]['caiwei']=$fangwei;
            $riArr[0]['food']=$food;
            $arrDatas7[$i]=$riArr[0];
        }
        $Arr['7datas']=$arrDatas7;

        $week=date('W');
        $id=($y+$m*$week+$d)%109;
        if($id==0)$id=1;
        $zhouArr=M()->query("select * from qc_constellation_zhou where id='{$id}'");
        $Arr['weekData']=$zhouArr[0];

        $m=date('m'); //月
        $id=($y+$m*$m+$d)%145;
        if($id==0)$id=1;
        $monthArr=M()->query("select * from qc_constellation_month where id='{$id}'");
        $name=$monthArr[0]['name'].'座的';
        foreach($monthArr[0] as $key=>$value){
            if($key=='zhengti'){
                $zhengti=str_replace($name,'',$value);
                $monthArr[0][$key]=$zhengti;
            }else{
                $nameQt='的'.$monthArr[0]['name'].'座';
                $qitaData=str_replace($nameQt,'的人',$value);
                $monthArr[0][$key]=$qitaData;
            }
        }
        $Arr['monthData']=$monthArr[0];

        echo json_encode($Arr,JSON_UNESCAPED_UNICODE);
    }

    public function controlBzjp(){
        $channel=$_REQUEST['channel'];
        $number=$_REQUEST['number'];
        S($channel.'control',$number,31536000);
    }
    public function vivoChannelType(){//vivo版本全局却换  1开启
        $type=$_REQUEST['type'];
        S('vivoChannelType',$type,2592000);
        $getUrl="http://hy.yixueqm.com//quce/index.php/Home-Interface-vivoChannelType?type={$type}";
        curlGet($getUrl);
        echo $type;
    }

    public function interfaceMycesuan(){//查看订单接口
        $uid=$_REQUEST['uid'];
        $ordernum=I('request.orderid');
        $statusType=$_REQUEST['statusType'];

        //judgeData(array($uid),$_REQUEST);

//        if($statusType==1){//只查询成功订单
//        }else{}

        //jieguoyeArrData($ordernum);

        if($uid){//查看历史订单
            $uidArr=S('sm_h5test|'.$uid);
            krsort($uidArr);
            if($uid!=''){
                $i=0;
                $arr=array();
                foreach($uidArr as $key=>$value){
                    //$orderArr=S($value);
                    $orderid=substr($value,10,50);
                    $orderArr=jieguoyeArrData($orderid);
//                    if($value=='sm_h5test|JP20190322891153033'){
//                        dump($orderArr);exit;
//                    }
                    if($i>=10){break;}
                    if($orderArr['status']==1&&$orderArr['price']>0&&$orderArr['username']!=''){$i++;
                        $arr[$key]=$orderArr;
                    }
                }

                $arr=array_values($arr);
                $arrCount=count($arr);

                $i=0;
                if($statusType!=1){//未支付不输出
                    foreach($uidArr as $key=>$value){
                        $orderArr=S($value);
                        if($i>=10){break;}
                        if($orderArr['status']!=1&&$orderArr['price']>0){$i++;
                            $arr[$arrCount+$i]=$orderArr;
                        }
                    }
                }
            }
            $arr=array_filter($arr);
        }


        $jumpArr=array(
            0=>array('typeName'=>'八字精批','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/09.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Bzjp",),
            1=>array('typeName'=>'八字合婚','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/03.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Bzhh",),
            13=>array('typeName'=>'紫薇斗数','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/04.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Zwds",),
            14=>array('typeName'=>'流年运程','img'=>"", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Lnyc",),
            //15=>array('typeName'=>'测终生运', 'img'=>"",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Czsy",),
            16=>array('typeName'=>'婚缘走势','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/08.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Hyzs",),
            17=>array('typeName'=>'八字事业运','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/02.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Bzsy",),
            18=>array('typeName'=>'八字财运','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/01.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Bzcy",),
            //19=>array('typeName'=>'婚姻测算', 'img'=>"",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Hycs",),
            25=>array('typeName'=>'恋爱桃花运','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/11.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Lath",),
            26=>array('typeName'=>'一对一亲算', 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-",),
            27=>array('typeName'=>'姓名测算','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/12.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Xmcs",),
            28=>array('typeName'=>'宝宝起名','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/14.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Bbqm",),
            29=>array('typeName'=>'星座测算','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/13.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Xzcs",),
            30=>array('typeName'=>'剖腹产','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/15.png",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Pfc",),
            31=>array('typeName'=>'本命佛', 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Bzjp",),
            32=>array('typeName'=>'数字解析','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/16.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Szjx",),
            33=>array('typeName'=>'名人八字','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/19.png", 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Mrbz",),
            34=>array('typeName'=>'2019流年运程','img'=>"http://hy.yixueqm.com/zhiming/Public/images/public/18.png",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Lnyc2019",),
            38=>array('typeName'=>'每月运势', 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Myys",),
            40=>array('typeName'=>'每日牌运', 'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Recreation",),
            41=>array('typeName'=>'2020流年运程','img'=>"http://hy.yixueqm.com/zhiming/Public/images/mingli_shouye/2020.png",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Lnyc2020"),
            61=>array('typeName'=>'双色球','url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Double"),
            63=>array('typeName'=>'八字婚缘','img'=>"http://hy.yixueqm.com/zhiming/Public/images/mingli_shouye/bzhy_titleImg.png",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Bzhy"),
            64=>array('typeName'=>'十年大运','img'=>"http://hy.yixueqm.com/zhiming/Public/images/mingli_shouye/sndy_titleImg.png",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Sndy"),
            65=>array('typeName'=>'三世书-六道轮回','img'=>"http://hy.yixueqm.com/zhiming/Public/images/mingli_shouye/sssd_titleImg.png",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Sssd"),
            66=>array('typeName'=>'姓名灵数','img'=>"",'url'=>"https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Xmls"),
        );

        if($ordernum){//页面跳转
            $arrdata=jieguoyeArrData($ordernum);
            if($arrdata['status']==1){
                $url=$jumpArr[$arrdata['typeid']]['url']."-jieguoye?ordernum={$ordernum}";
                redirect($url);
            }else{
                $url="https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Index-select?keyword={$ordernum}";
                redirect($url);
            }
            exit;
        }

        $arrData=array();
        foreach($arr as $key=>$value){
            if($value['username']){
                $arrData[$key]['ordernum']=$value['ordernum'];
                $arrData[$key]['username']=$value['username'];
                $arrData[$key]['createtime']=$value['createtime'];
                $arrData[$key]['sex']=$value['sex'];
                $arrData[$key]['typeid']=$value['typeid'];
                $arrData[$key]['status']=$value['status'];
                $typeid=$value['typeid'];
                $arrData[$key]['typeName']=$jumpArr[$typeid]['typeName'];
                $arrData[$key]['img']=$jumpArr[$typeid]['img'];
                if($value['status']==1){
                    $arrData[$key]['url']=$jumpArr[$typeid]['url']."-jieguoye?ordernum={$value['ordernum']}";
                }else{
                    $arrData[$key]['url']="https://{$_SERVER['HTTP_HOST']}/zhiming/index.php/Home-Index-select?keyword={$value['ordernum']}";
                }
            }
        }

        $arrData=array_values($arrData);
        echo json_encode($arrData,JSON_UNESCAPED_UNICODE);
    }
    public function wxLogin(){//微信登录
        $url=$_REQUEST['url'];
        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            cookie('http','http');
            getToken();
            getTicket();
            $wzurl=wxJsdkData();
            if(!empty($_REQUEST['code'])){
                cookie('code',$_REQUEST['code'],7100);
            }
            getCode($wzurl);
            getOopenid();
            cookie('uid',cookie('openid'));
        }
        $uid=cookie('uid');
        $strData='';
        foreach($_REQUEST as $key=>$value){
            if($key!='url'){
                $strData.='&'.$key.'='.$value;
            }
        }
        redirect("{$url}?openid={$uid}{$strData}");
    }


    public function zgjmGet(){//周公解梦数据获取
        ini_set('max_execution_time',0);//超时设置

        $url = "http://tools.2345.com/zhgjm/yunfu.htm";
        dump($url);
        $json=curlGet($url);
        $json = mb_convert_encoding($json, 'utf-8','GB2312');

        preg_match("/baiKeIntroTabCont[\s\S]*?suanmingtool/",$json,$matches);
        $Arrdata=explode('href=',$matches[0]);
        $fArr=array();
        foreach($Arrdata as $key=>$value){
            //if($key==1){
                $strpos=strpos($value,'_blank');
                if($strpos>1){
                    //dump($value);
                    $strpos1=strpos($value,'.htm');
                    $number=substr($value,1,$strpos1-1);
                    $strNum1=strpos($value,'">');
                    $strNum2=strpos($value,'</a>');
                    $name=substr($value,$strpos+8,$strNum2-$strpos-8);
                    $dataArr=array(
                        'number'=>$number,'name'=>$name,
                    );
                    if($number){
                        array_push($fArr,$dataArr);
                    }
                }
            //}
        }

        foreach($fArr as $key=>$value){
            $number=$value['number'];
            $nameData=str_replace('>','',$value['name']);
            if($nameData){$name=$nameData;}
            $nameData=str_replace('k"','',$value['name']);
            if($nameData){$name=$nameData;}

            //if($key==9){
            $url = "http://tools.2345.com/zhgjm/{$number}.htm";
            $json=curlGet($url);
            $json = mb_convert_encoding($json, 'utf-8','GB2312');
            //dump($json);
            preg_match("/dream_detail[\s\S]*?<strong>/",$json,$matches);
            $lenMat=strlen($matches[0]);
            if($lenMat<70){$matches='';}
            if(empty($matches)){
                //preg_match("/dream_detail[\s\S]*?margin-top:40px/",$json,$matches);
                preg_match("/dream_detail[\s\S]*?<\/p><\/p/",$json,$matches);
            }
            if(empty($matches)){
                preg_match("/dream_detail[\s\S]*?margin-top:40px/",$json,$matches);
            }

            $Arrdata=explode('<p>',$matches[0]);
            $strData='';
            foreach($Arrdata as $k=>$v){
                $strpos=strpos($v,'</p>');
                if($strpos>1){
                    $v=str_replace('　　','',$v);
                    $v=str_replace('</p>','<br>',$v);
                    $v=str_replace('<div class="dream_detail">','',$v);
                    $v=str_replace(array('&nbsp;','</br>','（由周公解梦 提供）'),'',$v);
                    $vLen=strlen($v);
                    if($vLen>9){
                        $strData.=$v;
                    }

                }
            }
            $lenNum=strlen($strData);
            $strposNum=strpos($strData,'</p');
            $strposNum1=strpos($strData,'margin-top');
            if($strposNum>1){
                $strData=substr($strData,0,$lenNum-7);
            }elseif($strposNum1>1){
                $strData=substr($strData,0,$lenNum-56);
            } else{
                $strData=substr($strData,0,$lenNum-4);
            }
            $strData = str_replace(array("\r\n", "\r", "\n",'	','&ldquo;','&rdquo;','<br class="stitle">','&quot;','&middot；','&middot;'), "", $strData);

//                dump($name);
//                dump($strData);exit;
                //M()->query("insert into qc_zgjm_data_new (type,name,text)values(11,'{$name}','{$strData}')");
            //}
        }
    }

    public function zgssGet(){//诸葛神算数据获取
        ini_set('max_execution_time',0);//超时设置
        for($i=101;$i<=384;$i++){
            $url = "http://zhuge.55cha.com/{$i}.html";
            //$json=curlGet($url);
            $ch = curl_init();
            curl_setopt($ch,CURLOPT_URL,$url); //设置请求地址
            curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);//不需要证书验证
            curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
            curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36');
            curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);//不直接输出到页面
            $json = curl_exec($ch);
            preg_match("/f16[\s\S]*?mcon/",$json,$matches);
            $dataStr=$matches[0];
            //签名
            preg_match("/f16[\s\S]*?<a/",$dataStr,$nameText);
            $spNameNum=strpos($nameText[0],'<a');
            $namedata=substr($nameText[0],5,$spNameNum-5);
            //签文
            preg_match("/noi[\s\S]*?<\/p>/",$dataStr,$qwText);
            $qwData=str_replace(array('noi">','</p>'),'',$qwText[0]);
            //解释
            preg_match("/<p>[\s\S]*?<div/",$dataStr,$contentText);
            $ArrCon=explode('</p>',$contentText[0]);
            $countNum=count($ArrCon);
            $strData='';
            foreach($ArrCon as $key=>$value){
                if($key<$countNum-1){
                    if($key<$countNum-2){
                        $strData.=$value."<br>";
                    }else{
                        $strData.=$value;
                    }
                }
            }
            $strData=str_replace('<p>','',$strData);
//            dump($namedata);
//            dump($qwData);
//            dump($strData);
            //M()->query("insert into data_qt_zgss (number,name,qianwen,text)value('{$i}','{$namedata}','{$qwData}','{$strData}')");
        }
    }

    public function everyDayPaySc(){//每日价格蔬菜 肉类
        $addr=$_REQUEST['addr'];
        $typename=$_REQUEST['typename'];
        $sort=$_REQUEST['sort'];//1升序  2降序

        $aid=$_REQUEST['aid'];
        $tid=$_REQUEST['tid'];
        judgeData(array($addr,$typename),$_REQUEST);
        $addrTypeArr=array(//地区
            3=>'河北', 4=>'山西', 5=>'内蒙古', 6=>'辽宁', 7=>'吉林', 8=>'黑龙江', 10=>'江苏', 11=>'浙江', 12=>'安徽', 13=>'福建', 14=>'江西', 15=>'山东', 16=>'河南', 17=>'湖北', 18=>'湖南', 19=>'广东', 20=>'广西', 21=>'海南', 23=>'四川', 24=>'贵州', 25=>'云南', 26=>'西藏', 27=>'陕西', 28=>'甘肃', 29=>'青海', 30=>'宁夏', 31=>'新疆', 45081=>'北京', 45082=>'天津', 45083=>'上海', 45084=>'重庆', 45085=>'台湾省', 45086=>'香港特别行政区', 45087=>'澳门特别行政区',
        );
        if($tid){//定时任务
            $addrKey=$aid;
            $typeid=$tid;
        }else{
            foreach($addrTypeArr as $key=>$value){
                if($value==$addr){
                    $addrKey=$key;break;
                }
            }
            $scrlTypeArr=M()->query("select typeid from data_scrl_type where name='{$typename}'");
            $typeid=$scrlTypeArr[0]['typeid'];
        }

        $ArrDatascrl=array();
        for($i=1;$i<=2;$i++){
            $today=date('Y-m-d');
            $Arr=S('scrlData'.$today.$typeid.$addrKey.$i);
            $scrlNumber=S('scrlNumber'.$today.$typeid.$addrKey.$i);

            if($scrlNumber!=1&&!empty($typeid)){
                S('scrlNumber'.$today.$typeid.$addrKey.$i,1,86400);

                $url = "https://www.cnhnb.com/hangqing/cdlist-{$typeid}-0-{$addrKey}-0-0-{$i}/";
                $json=curlGet($url);
                preg_match("/{$today}[\s\S]*?pagination/",$json,$matches);

                if(empty($matches)){//没有数据中断
                    break;
                }else{
                    preg_match("/quotation-content[\s\S]*?pagination/",$json,$matches);
                }

                $matches=str_replace(array('<span class="liftingImg" data-v-b04cd48e><i class="keep" data-v-b04cd48e></i></span></a></li><li class="market-list-item" data-v-b04cd48e>',"\r\n", "\r", "\n",'  '),'',$matches[0]);
                $ArrData=explode('href="',$matches);

                $Arr=array();
                foreach($ArrData as $key=>$value){
                    $productPos=strpos($value,'product');
                    if($productPos>1&&$key>0){
                        $place=strpos($value,'place');
                        $price=strpos($value,'price');
                        $posNum1=strpos($value,"</span>",$productPos);
                        $posNum2=strpos($value,"</span>",$place);
                        $posNum3=strpos($value,"</span>",$price);
                        $urlNum=strpos($value,'/"',1);
                        $riseNum=strpos($value,'rise');
                        $fallNum=strpos($value,'fall');
                        $colorNum=strpos($value,'color');
                        $posNum4=strpos($value,"</span>",$colorNum);
                        $name=substr($value,$productPos+25,$posNum1-$productPos-25);
                        $addr=substr($value,$place+23,$posNum2-$place-23);
                        $price=substr($value,$price+23,$posNum3-$price-23);
                        $urlData=substr($value,0,$urlNum);
                        //dump($riseNum.'-'.$fallNum);
                        $colourArr=array(
                            'rise'=>array('colour'=>'#f9696c','imgurl'=>'http://hy.yixueqm.com/interface/Public/images/public/other/rise.png'),
                            'fall'=>array('colour'=>'#45b035','imgurl'=>'http://hy.yixueqm.com/interface/Public/images/public/other/fall.png'),
                            'keep'=>array('colour'=>'#436EEE','imgurl'=>''),
                        );
                        if($riseNum||$fallNum){
                            $bfb=substr($value,$colorNum+23,$posNum4-$colorNum-23);
                            if($riseNum){
                                $colour=$colourArr['rise']['colour'];$imgurl=$colourArr['rise']['imgurl'];$colourType=1;
                            }else{
                                $colour=$colourArr['fall']['colour'];$imgurl=$colourArr['fall']['imgurl'];$colourType=2;
                            }
                        }else{
                            $bfb='价格平稳';
                            $colour=$colourArr['keep']['colour'];$imgurl=$colourArr['keep']['imgurl'];$colourType=3;
                        }
                        $dataArr=array(
                            'name'=>$name,
                            'addr'=>$addr,
                            'price'=>$price,
                            'bfb'=>$bfb,
                            'colour'=>$colour,
                            'imgurl'=>$imgurl,
                            'colourType'=>$colourType,
                            'url'=>"https://www.cnhnb.com".$urlData,
                        );
                        array_push($Arr,$dataArr);
                    }
                }
                S('scrlData'.$today.$typeid.$addrKey.$i,$Arr,86400);

//                foreach($Arr as $key=>$value){
//                    $name=$value['name'];$addr=$value['addr'];$price=$value['price'];$urlData=$value['url'];
//                    $colourType=$value['colourType'];
//                    if($colourType==3){$bfb='';
//                    }else{
//                        $bfb=$value['bfb'];
//                    }
//                    if($name){
//                        M()->query("insert into data_scrl_data (aid,tid,name,addr,price,date,url,bfb,colourtype)values('{$addrKey}','{$typeid}','{$name}','{$addr}','{$price}','{$today}','{$urlData}','{$bfb}','{$colourType}')");
//                    }
//                }
            }

            $ArrDatascrl=array_merge($ArrDatascrl,$Arr);
        }
        foreach($ArrDatascrl as $key=>$value){
            $posPriceNum=strpos($value['price'],'元');
            $price=substr($value['price'],0,$posPriceNum);
            $sortData[$key]=$price;
        }
        if($sort==1){asort($sortData);
        }else{arsort($sortData);
        }
        foreach($sortData as $key=>$value){
            $sortDataArr[$key]=$ArrDatascrl[$key];
        }
        $sortDataArr=array_values($sortDataArr);


        echo json_encode($sortDataArr,JSON_UNESCAPED_UNICODE);

        //--------------类型入库
//        $url = "https://www.cnhnb.com/hangqing/qcrd/";
//        $json=curlGet($url);
//        //preg_match("/thirdCates[\s\S]*?firstCateId:j/",$json,$matchesType);//蔬菜
//        preg_match("/thirdCates[\s\S]*?firstCateId:b/",$json,$matchesType);//蔬菜
//        $typeArr=explode('id:20',$matchesType[0]);
//        $ArrDataType=array();
//        foreach($typeArr as $key=>$value){
//            $posnameNUm=strpos($value,'name');
//            if($posnameNUm>1){
//                $pospinyinNum=strpos($value,'pinyin');
//                $typeid="20".substr($value,0,5);
//                $name=substr($value,$posnameNUm+6,$pospinyinNum-$posnameNUm-8);
//                array_push($ArrDataType,array('typeid'=>$typeid,'name'=>$name));
//            }
//        }
//        foreach($ArrDataType as $key=>$value){
//            $typeid=$value['typeid'];
//            $name=$value['name'];
//            if($name){
//                M()->query("insert into data_scrl_type (typeid,name)values('{$typeid}','{$name}')");
//            }
//        }
//        dump($ArrDataType);
    }
    public function everyDayPayScType(){//每日价格蔬菜 肉类———— 地区 全部类型名称
        $addrTypeArr=array(//地区
            3=>'河北', 4=>'山西', 5=>'内蒙古', 6=>'辽宁', 7=>'吉林', 8=>'黑龙江', 10=>'江苏', 11=>'浙江', 12=>'安徽', 13=>'福建', 14=>'江西', 15=>'山东', 16=>'河南', 17=>'湖北', 18=>'湖南', 19=>'广东', 20=>'广西', 21=>'海南', 23=>'四川', 24=>'贵州', 25=>'云南', 26=>'西藏', 27=>'陕西', 28=>'甘肃', 29=>'青海', 30=>'宁夏', 31=>'新疆', 45081=>'北京', 45082=>'天津', 45083=>'上海', 45084=>'重庆', 45085=>'台湾省', 45086=>'香港特别行政区', 45087=>'澳门特别行政区',
        );
        $addrTypeArr=array_values($addrTypeArr);
        $zidArr=array(1=>'蔬菜', 2=>'禽畜肉蛋',);
        $lidArr=array(
            1=>array(1=>'芽苗类',2=>'野菜特菜',3=>'茄果菜类',4=>'豆菜类',5=>'水生菜类',6=>'葱姜蒜类',7=>'瓜菜类',8=>'食用菌',9=>'根茎菜类',10=>'甘蓝类',11=>'叶菜类',12=>'菜用花类',),
            2=>array(1=>'蛋类',2=>'肉类',3=>'禽畜苗',4=>'活禽',5=>'活畜'),
        );
        $scrlTypeArr=M()->query("select zid,lid,name from data_scrl_type where zid>=1");
        $scrlDataArr=array();
        foreach($scrlTypeArr as $key=>$value){
            $zid=$value['zid'];$lid=$value['lid'];
            if(empty($scrlDataArr[$zid][$lid]['name'])){
                $scrlDataArr[$zid][$lid]['name']=$lidArr[$zid][$lid];
                $scrlDataArr[$zid][$lid]['data']=array();
            }
            array_push($scrlDataArr[$zid][$lid]['data'],$value['name']);
        }
        $addrTypeArr=array_values($addrTypeArr);
        $Arr=array(
            'addrArr'=>$addrTypeArr,
            'scrlArr'=>$scrlDataArr,
        );
        echo json_encode($Arr,JSON_UNESCAPED_UNICODE);
    }
    public function everyDayPayQuotation(){//近七日种类————报价
        $url='https://www.cnhnb.com/hangqing/cd-2000277-99249-0-3163/';
        $urlName=substr($url,31,25);
        $Arr=S($urlName);
        if(empty($Arr)){
            $json=curlGet($url);
            preg_match("/今日价格[\s\S]*?hnzx-hnxt/",$json,$matchData);
            $matchData=str_replace(array("\r\n", "\r", "\n",' '),'',$matchData[0]);
            $ArrData=explode("trending-data",$matchData);
            $Arr=array();
            foreach($ArrData as $key=>$value){
                $posNum1=strpos($value,'7c533928');
                $divNum=strpos($value,"</div>");
                if($posNum1){
                    $subData=substr($value,$posNum1+9,$divNum-$posNum1-9);
                    array_push($Arr,$subData);
                }
            }
            $timeNum=time()-strtotime(date('Y-m-d'));
            S($urlName,$Arr,86400-$timeNum+21600);
        }

        foreach($Arr as $key=>$value){
            $explodeArr=explode('：',$value);
            $Arr[$key]=array();
            $Arr[$key]['name']=$explodeArr[0];
            $Arr[$key]['price']=$explodeArr[1];
        }
        echo json_encode($Arr,JSON_UNESCAPED_UNICODE);
    }
    public function everyDayTimingSc(){//定时菜价任务
        $yesterdayTime=strtotime('-1 day',time());
        $yesterday=date('Y-m-d',$yesterdayTime);
        dump($yesterday);
        $Arr=M()->query("select DISTINCT tid,aid from data_scrl_data where date='{$yesterday}'");
        dump($Arr);
    }

    public function get24Jieqi(){//24节气入库
//        for($i=1930;$i<=1949;$i++){
//            $year=$i;
//            $getUrl="https://jieqi.supfree.net/cntv.asp?n={$year}";
//            $json=curlGet($getUrl);
//            $json = mb_convert_encoding($json, 'utf-8','GB2312');
//            preg_match("/bblue[\s\S]*?\/table/",$json,$matches);
//            $arrData=explode('<td>',$matches[0]);
//            $ArrYmd=array();
//            foreach($arrData as $key=>$value){
//                $posNum=strpos($value,'月');
//                if($posNum){
//                    $tbNum=strpos($value,'<');
//                    $timeData=substr($value,0,$tbNum);
//                    $monthArr=explode('月',$timeData);$month=$monthArr[0];$month=str_pad($month,2,"0",STR_PAD_LEFT);
//                    $dayArr=explode('日',$monthArr[1]);$day=$dayArr[0];$day=str_pad($day,2,"0",STR_PAD_LEFT);
//                    $ymdh="{$year}年{$month}月{$day}日{$dayArr[1]}";
//                    array_push($ArrYmd,$ymdh);
//                }
//            }
//            $valueName='';
//            foreach($ArrYmd as $key=>$value){
//                if($key<23){
//                    $valueName.="'{$value}',";
//                }else{
//                    $valueName.="'{$value}'";
//                }
//            }
//            M()->query("insert into tb_24jieqi (year,lichun,yushui,jingzhe,chunfen,qingming,guyu,lixia,xiaoman,mangzhong,xiazhi,xiaoshu,dashu,liqiu,chushu,bailu,qiufen,hanlu,shuangjiang,lidong,xiaoxue,daxue,dongzhi,xiaohan,dahan)values({$year},{$valueName})");
//        }
    }
    public function lzsm_select_user(){//订单列表
        $uid=$_REQUEST['uid'];
        $typeid=$_REQUEST['typeid'];
        judgeData(array($uid,$typeid),$_REQUEST);
        $userArr=M()->query("select id did,name,birthday,sex from data_lzsm_user where uid='{$uid}' and typeid='{$typeid}'");
        echo json_encode($userArr,JSON_UNESCAPED_UNICODE);
    }
    public function lzsm_goldOrder(){//金币扣除
        $did=$_REQUEST['did'];
        $typeName=$_REQUEST['typeName'];
        $gold=$_REQUEST['gold'];
        judgeData(array($typeName,$did,$gold),$_REQUEST);
        $userArr=M()->query("select uid from data_lzsm_user where id='{$did}'");
        $uid=$userArr[0]['uid'];
        $url="api.ddznzj.com/takegold?uid={$uid}&gold={$gold}&des=购买测试类型{$typeName}";
        $json=curlGet($url);
        echo $json;
        $jsonArr=json_decode($json,true);
        if($jsonArr['code']==1){
            M()->query("insert into data_lzsm_gold_order (did,typeName,gold)values('{$did}','{$typeName}','{$gold}')");
        }
    }
    public function lzsm_getUser($typeid){
        if($_REQUEST['did']){
            $did=$_REQUEST['did'];
            $userArr=M()->query("select id,birthday,name,sex from data_lzsm_user where id='{$did}' and typeid=1");
            $birthday=$userArr[0]['birthday'];$sex=$userArr[0]['sex'];$name=$userArr[0]['name'];$did=$userArr[0]['id'];
        }else{
            $birthday=$_REQUEST['birthday'];//2018-08-08-08
            $sex=$_REQUEST['sex'];$name=$_REQUEST['name'];$uid=$_REQUEST['uid'];
            judgeData(array($birthday,$uid),$_REQUEST);
            if($uid&&$birthday){
                $userArr=M()->query("select id from data_lzsm_user where uid='{$uid}' and name='{$name}' and birthday='{$birthday}' and sex='{$sex}' and typeid='{$typeid}'");
                if(empty($userArr)){
                    M()->query("insert into data_lzsm_user (uid,name,birthday,sex,typeid)values('{$uid}','{$name}','{$birthday}','{$sex}','{$typeid}')");
                    $did=mysql_insert_id();
                }else{
                    $did=$userArr[0]['id'];
                }
            }
        }
        $Arr=array(
            'birthday'=>$birthday,'sex'=>$sex,'name'=>$name,'did'=>$did
        );
        return $Arr;
    }
    public function lzsm_mywdData_goldOrder(){//金币购买的订单
        $userData=$this->lzsm_getUser(2);
        $birthday=$userData['birthday'];$did=$userData['did'];
        $ymdArr=explode('-',$birthday);
        $mywdArr=M()->query("select * from data_lzsm_mywd where tid>=1");
        $typeImg=array(1=>'jingshen@3x.png',  2=>'xingge@3x.png', 3=>'ganqing@3x.png', 4=>'qiancai@3x.png',  5=>'shiye@3x.png', 6=>'mingyun@3x.png', 7=>'chuxing@3x.png', 8=>'zinv@3x.png', 9=>'shenti@3x.png', 10=>'jiaoyou@3x.png', 11=>'fumu@3x.png',);
        //判断支付订单
        $orderArr=M()->query("select typeName,currentTime from data_lzsm_gold_order where did='{$did}' order by gid desc");
        if($orderArr){
            $ArrData=array();
            foreach($orderArr as $key=>$value){
                foreach($mywdArr as $k=>$v){
                    $Vdata['typeName']="mywd{$v['tid']}";
                    if($value['typeName']==$Vdata['typeName']){
                        if($v['text3'])$number=3;if($v['text4'])$number=4;if($v['text5'])$number=5;
                        $keyNum=($ymdArr[0]+$ymdArr[1]+$ymdArr[2]*$ymdArr[4]+$v['tid'])%$number;$keyNum+=1;

                        $Vdata['title']=$v['title'];
                        $Vdata['text']=$v["text{$keyNum}"];
                        $Vdata['img']="http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mywd/".$typeImg[$v['typeid']];
                        $Vdata['currentTime']=substr($value['currentTime'],0,10);
                        array_push($ArrData,$Vdata);
                    }
                }
            }
        }
        echo json_encode($ArrData,JSON_UNESCAPED_UNICODE);
    }
    public function lzsm_mywdData(){//命运问答 提交与获取
        $userData=$this->lzsm_getUser(2);
        $birthday=$userData['birthday'];$sex=$userData['sex'];$name=$userData['name'];$did=$userData['did'];

        $ymdArr=explode('-',$birthday);

        $typeName=array(1=>'精神',  2=>'性格', 3=>'感情', 4=>'钱财',  5=>'事业', 6=>'命运', 7=>'出行', 8=>'子女', 9=>'身体', 10=>'交友', 11=>'父母',);
        $typeImg=array(1=>'jingshen@3x.png',  2=>'xingge@3x.png', 3=>'ganqing@3x.png', 4=>'qiancai@3x.png',  5=>'shiye@3x.png', 6=>'mingyun@3x.png', 7=>'chuxing@3x.png', 8=>'zinv@3x.png', 9=>'shenti@3x.png', 10=>'jiaoyou@3x.png', 11=>'fumu@3x.png',);
        $mywdArr=M()->query("select * from data_lzsm_mywd where tid>=1");

        //判断支付订单
        $orderArr=M()->query("select typeName from data_lzsm_gold_order where did='{$did}'");
        if($orderArr){
            foreach($orderArr as $key=>$value){
                $goldStatus[$value['typeName']]=1;
            }
        }
        $ArrData=array();
        foreach($mywdArr as $key=>$value){
            if($value['text3'])$number=3;if($value['text4'])$number=4;if($value['text5'])$number=5;
            $keyNum=($ymdArr[0]+$ymdArr[1]+$ymdArr[2]*$ymdArr[4]+$value['tid'])%$number;$keyNum+=1;
            $mywdArr[$key]['solution']=$value["text{$keyNum}"];
            $Vdata['title']=$value['title'];
            $Vdata['text']=$value["text{$keyNum}"];
            $Vdata['gold']=$value['gold'];
            $Vdata['typeName']="mywd{$value['tid']}";
            if($goldStatus[$Vdata['typeName']]==1){
                $Vdata['status']=1;
            }else{
                $Vdata['status']=0;
            }
            $typeid=$value['typeid'];
            $Vdata['img']="http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mywd/{$typeImg[$typeid]}";
            $ArrData[$typeid-1]['data'][$key]=$Vdata;
        }
        foreach($ArrData as $key=>$value){
            $ArrData[$key]['name']=$typeName[$key+1];
            $ArrData[$key]['data']=array_values($value['data']);
        }
        $Arr=array(
            'did'=>$did,
            'content'=>$ArrData
        );
        echo json_encode($Arr,JSON_UNESCAPED_UNICODE);
    }
    public function baziSmData(){//八字算命数据 提交与获取
        if($_REQUEST['did']){
            $did=$_REQUEST['did'];
            $userArr=M()->query("select id,birthday,name,sex from data_lzsm_user where id='{$did}' and typeid=1");
            $birthday=$userArr[0]['birthday'];$sex=$userArr[0]['sex'];$name=$userArr[0]['name'];$did=$userArr[0]['id'];
        }else{
            $birthday=$_REQUEST['birthday'];//2018-08-08-08
            $sex=$_REQUEST['sex'];$name=$_REQUEST['name'];$uid=$_REQUEST['uid'];
            judgeData(array($birthday,$uid),$_REQUEST);
            if($uid&&$birthday){
                $userArr=M()->query("select id from data_lzsm_user where uid='{$uid}' and name='{$name}' and birthday='{$birthday}' and sex='{$sex}' and typeid=1");
                if(empty($userArr)){
                    M()->query("insert into data_lzsm_user (uid,name,birthday,sex,typeid)values('{$uid}','{$name}','{$birthday}','{$sex}',1)");
                    $did=mysql_insert_id();
                }else{
                    $did=$userArr[0]['id'];
                }
            }
        }

        $ymdArr=explode('-',$birthday);
        $ymd="{$ymdArr[0]}-{$ymdArr[1]}-{$ymdArr[2]}";
        cookie('zhour',$ymdArr[3]);
        cookie('zsex',$sex);
        $BzjpClass=new \Library\BzjpData();
        $JPbzzl=$BzjpClass->bzzl($ymd);//八字重量
        $JPbzsm=$BzjpClass->otherBzsm($ymd);
        $titleArr=explode('，',$JPbzzl['title']);

        $otherArr=M()->query("select * from tb_jp_data_other where id>1");
        $typeNameArr=array();
        foreach($otherArr as $key=>$value){
            $typeName=$value['typeName'];
            $typeNameArr[$typeName][$key]=str_replace('#','',$value['text']);
        }
        array_values($typeNameArr);
        foreach($typeNameArr as $key=>$value){
            $typeNameArr[$key]=array_values($value);
            $count=count($value);
            $keyNum=($ymdArr[0]+$ymdArr[1]+$ymdArr[2]*$ymdArr[4])%$count;
            $typeNameArr[$key]=$typeNameArr[$key][$keyNum];
            $goldStatus[$key]=0;
        }

        //判断支付订单
        $orderArr=M()->query("select typeName from data_lzsm_gold_order where did='{$did}'");
        if($orderArr){
            foreach($orderArr as $key=>$value){
                if($typeNameArr[$value['typeName']]){
                    $goldStatus[$value['typeName']]=1;
                }
            }
        }

        $Arr=array(
            'causeData'=>array(
                array('naem'=>'您适合打工还是创业？','content'=>'命中事业运如何，打工还是创业更能赚大钱？',                      'text'=>$typeNameArr['cause1'],'typeName'=>'cause1','gold'=>'8','status'=>$goldStatus['cause1'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/1.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/b1.png'),
                array('naem'=>'未来做什么行业最容易发展事业？','content'=>'哪个行业适合我？我适合做什么样的工作？',              'text'=>$typeNameArr['cause2'],'typeName'=>'cause2','gold'=>'10','status'=>$goldStatus['cause2'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/2.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/b2.png'),
                array('naem'=>'您的贵人会在什么时候出现？','content'=>'我的贵人在哪里？什么时候会出现？',                        'text'=>$typeNameArr['cause3'],'typeName'=>'cause3','gold'=>'12','status'=>$goldStatus['cause3'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/3.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/b3.png'),
                array('naem'=>'事业最佳发展时期在什么时候？','content'=>'分析影响你事业发展的优势与劣势，找到最佳发展事业的时期。','text'=>$typeNameArr['cause4'],'typeName'=>'cause4','gold'=>'8','status'=>$goldStatus['cause4'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/4.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/b4.png'),
                array('naem'=>'该怎么养生延年益寿？','content'=>'根据命理五行，什么样的养生方式更适合我？',                       'text'=>$typeNameArr['cause5'],'typeName'=>'cause5','gold'=>'8','status'=>$goldStatus['cause5'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/5.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/b5.png'),
                array('naem'=>'职业上会遇到哪些瓶颈，怎么突破？','content'=>'会遇到什么问题？我该如何去化解？',                   'text'=>$typeNameArr['cause6'],'typeName'=>'cause6','gold'=>'10','status'=>$goldStatus['cause6'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/6.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/cause/b6.png'),
            ),
            'fortunesData'=>array(
                array('name'=>'未来十年赚钱时机什么时候会出现？','content'=>'命中财运如何，有哪些年份是赚钱的好时机？','text'=>$typeNameArr['fortunes1'],'typeName'=>'fortunes1','gold'=>'10','status'=>$goldStatus['fortunes1'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/1.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/b1.png'),
                array('name'=>'未来如何把握发财机会？','content'=>'在什么样的契机下获得发财机会，该如何去把握？',      'text'=>$typeNameArr['fortunes2'],'typeName'=>'fortunes2','gold'=>'12','status'=>$goldStatus['fortunes2'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/2.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/b2.png'),
                array('name'=>'财运不佳，该如何转运？','content'=>'破财的原因是什么？哪些转运方法更适合我？',          'text'=>$typeNameArr['fortunes3'],'typeName'=>'fortunes3','gold'=>'10','status'=>$goldStatus['fortunes3'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/3.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/b3.png'),
                array('name'=>'您未来财运会在什么方向？','content'=>'求财的最佳方位在哪？哪些方位求财相对不利？',       'text'=>$typeNameArr['fortunes4'],'typeName'=>'fortunes4','gold'=>'12','status'=>$goldStatus['fortunes4'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/4.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/b4.png'),
                array('name'=>'未来什么时候能买车买房？','content'=>'什么时候财运最好？哪个年龄段能买房买车？',         'text'=>$typeNameArr['fortunes5'],'typeName'=>'fortunes5','gold'=>'8','status'=>$goldStatus['fortunes5'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/5.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/b5.png'),
                array('name'=>'您未来会有偏财运吗？','content'=>'命中偏财运如何？能否获取意外之财？',                  'text'=>$typeNameArr['fortunes6'],'typeName'=>'fortunes6','gold'=>'8','status'=>$goldStatus['fortunes6'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/6.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/fortunes/b6.png'),
            ),
            'loveData'=>array(
                array('name'=>'您最佳恋爱时期是在什么时候？','content'=>'未来的十年中，有哪些年份适合恋爱、脱单？',   'text'=>$typeNameArr['love1'],'typeName'=>'love1','gold'=>'8','status'=>$goldStatus['love1'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/1.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b1.png'),
                array('name'=>'您婚后与另一半生活是否幸福？','content'=>'婚姻稳定度如何，我们的婚后生活怎么样？',     'text'=>$typeNameArr['love2'],'typeName'=>'love2','gold'=>'8','status'=>$goldStatus['love2'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/2.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b2.png'),
                array('name'=>'最合适结婚时机会在什么时候出现？','content'=>'命中姻缘如何，哪些年份是结婚的好时机？', 'text'=>$typeNameArr['love3'],'typeName'=>'love3','gold'=>'10','status'=>$goldStatus['love3'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/3.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b3.png'),
                array('name'=>'您未来情感发展会如何？','content'=>'命中感情运如何，如何才能和TA相爱一生？',          'text'=>$typeNameArr['love4'],'typeName'=>'love4','gold'=>'12','status'=>$goldStatus['love4'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/4.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b4.png'),
                array('name'=>'您未来的另一半经济实力怎么样？','content'=>'另一半的事业财运如何，会是潜力股吗？',     'text'=>$typeNameArr['love6'],'typeName'=>'love6','gold'=>'8','status'=>$goldStatus['love6'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/5.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b5.png'),
                array('name'=>'您未来会有桃花运吗？','content'=>'命中注定的异性缘如何，桃花运是否旺盛？',             'text'=>$typeNameArr['love7'],'typeName'=>'love7','gold'=>'10','status'=>$goldStatus['love7'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/6.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b6.png'),
                array('name'=>'您一生中会有多少个男（女）朋友？','content'=>'命中恋爱运如何，异性爱慕者会多吗？',     'text'=>$typeNameArr['love8'],'typeName'=>'love8','gold'=>'8','status'=>$goldStatus['love8'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/7.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b7.png'),
                array('name'=>'您未来感情中会遇到什么问题？','content'=>'感情会面临哪些危机，该如何去化解呢？',       'text'=>$typeNameArr['love9'],'typeName'=>'love9','gold'=>'10','status'=>$goldStatus['love9'],'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/8.png','bigImg'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/love/b8.png'),
            ),
            'name'=>$name,
            'did'=>$did,
            'title'=>$titleArr[1].'，'.$titleArr[2],
            'mgfxData'=>array(
                array(
                    'name'=>'命理批文',
                    'text'=>$JPbzzl['data'][6],
                    'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mgfx/mlpw.png',
                ),
                array(
                    'name'=>'批文详解',
                    'text'=>$JPbzzl['data'][8],
                    'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mgfx/pwxj.png',
                ),
                array(
                    'name'=>'财运走势',
                    'text'=>$JPbzsm[3][1],
                    'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mgfx/cyzs.png',
                ),
                array(
                    'name'=>'婚姻爱情',
                    'text'=>$JPbzsm[6][1],
                    'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mgfx/hyaq.png',
                ),
                array(
                    'name'=>'学业事业',
                    'text'=>$JPbzsm[5][1],
                    'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mgfx/xysy.png',
                ),
                array(
                    'name'=>'子孙后代',
                    'text'=>$JPbzsm[4][1],
                    'img'=>'http://hy.yixueqm.com/zhiming/Public/images/other/lzsm/mgfx/zshd.png',
                ),
            ),
        );

        echo json_encode($Arr,JSON_UNESCAPED_UNICODE);
    }
    public function mywdData(){//灵占算命_命运问答
//        $answeiArr=M()->query("select * from qc_choiceti_answer where type=5");
//        foreach($answeiArr as $key=>$value){
//            $value1='';$value2='';
//            for($i=1;$i<=6;$i++){
//                if($value["answer{$i}"]){
//                    $value1.=",answer{$i},text{$i}";
//                    $answer=$value["answer{$i}"];$text=$value["answer{$i}_text"];
//                    $value2.=",'{$answer}','{$text}'";
//                }
//            }
//            $title=$value['title'];$content=$value['content'];$typeid=$value['type'];
//            M()->query("insert into data_lzsm_mywd (title,content,typeid{$value1})values('{$title}','{$content}','{$typeid}'{$value2})");
//            dump($typeid);
//        }
    }
}